fix syntax error and tests
This commit is contained in:
parent
d3b22afe16
commit
24eb53cc07
|
|
@ -28,7 +28,6 @@ module JamRuby
|
|||
|
||||
def run
|
||||
# get all weekly sessions that started at least 4 hours ago
|
||||
time_threshold = Time.now.
|
||||
criteria = "recurring_mode = 'weekly' AND scheduled_start + interval '4hours' < NOW() AND canceled = false AND next_session_scheduled = false"
|
||||
MusicSession.find_each(:conditions => criteria) do |music_session|
|
||||
music_session.copy
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ describe "MusicSessionScheduler" do
|
|||
|
||||
MusicSession.all.count.should == 1
|
||||
|
||||
# end the session
|
||||
ms.session_removed_at = Time.now
|
||||
# move the session back more than 4 hours
|
||||
ms.scheduled_start = Time.now - 5.hours
|
||||
ms.save!
|
||||
|
||||
# run the scheduler again
|
||||
|
|
@ -27,7 +27,6 @@ describe "MusicSessionScheduler" do
|
|||
|
||||
MusicSession.all.count.should == 2
|
||||
|
||||
MusicSession.where(:session_removed_at => nil).count.should == 1
|
||||
MusicSession.where(:next_session_scheduled => true).count.should == 1
|
||||
end
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ describe "MusicSessionScheduler" do
|
|||
@scheduler.run
|
||||
MusicSession.all.count.should == 1
|
||||
|
||||
ms.session_removed_at = Time.now
|
||||
ms.scheduled_start = Time.now - 3.hours
|
||||
ms.save!
|
||||
|
||||
@scheduler.run
|
||||
|
|
|
|||
Loading…
Reference in New Issue