Created
August 13, 2012 02:18
-
-
Save ddd1600/3336474 to your computer and use it in GitHub Desktop.
SetupDayData
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SetupDayData | |
attr_reader :iterations | |
def go | |
@day = nil | |
this_day = Startup.order(:al_created_at).first.al_created_at | |
iterations = Time.now - this_day.to_time | |
iterations = Integer(iterations/86400) | |
iterations.times do | |
beginning_of_day = this_day.beginning_of_day | |
end_of_day = this_day.end_of_day | |
al_day.startups_velocity = Startup.where("al_created_at BETWEEN '#{beginning_of_day}' AND '#{end_of_day}'").count | |
al_day.jobs_velocity = Job.where("al_created_at BETWEEN '#{beginning_of_day}' AND '#{end_of_day}'").count | |
al_day.save | |
this_date = this_day.to_date | |
this_date.next | |
this_day = this_date.to_time | |
end | |
end | |
end | |
##### returns: | |
#SyntaxError: /home/ddouglas/Develop/j_angel_research/lib/assets/setup_day_data.rb:17: invalid multibyte char (US-ASCII) | |
#/home/ddouglas/Develop/j_angel_research/lib/assets/setup_day_data.rb:17: syntax error, unexpected $end, expecting keyword_end | |
# al_day.startups_velocity =... | |
# ^ | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:469:in `load' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:469:in `block in load_file' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:639:in `new_constants_in' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:468:in `load_file' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:353:in `require_or_load' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:502:in `load_missing_constant' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:192:in `block in const_missing' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:190:in `each' | |
# from /var/lib/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:190:in `const_missing' | |
# from (irb):59 | |
# from /var/lib/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start' | |
# from /var/lib/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start' | |
# from /var/lib/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>' | |
# from script/rails:6:in `require' | |
# from script/rails:6:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment