summaryrefslogtreecommitdiff
path: root/app/models/occurrence.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/occurrence.rb')
-rw-r--r--app/models/occurrence.rb24
1 files changed, 8 insertions, 16 deletions
diff --git a/app/models/occurrence.rb b/app/models/occurrence.rb
index 62432d53..0760d5e8 100644
--- a/app/models/occurrence.rb
+++ b/app/models/occurrence.rb
@@ -11,25 +11,17 @@ class Occurrence < ActiveRecord::Base
11 # Class Methods 11 # Class Methods
12 12
13 def self.find_in_range start_time, end_time 13 def self.find_in_range start_time, end_time
14 find( 14 includes(:node)
15 :all, 15 .where("start_time > ? AND end_time < ?", start_time, end_time)
16 :include => :node, 16 .order("start_time")
17 :conditions => [
18 "start_time > ? AND end_time < ?", start_time, end_time
19 ],
20 :order => "start_time"
21 )
22 end 17 end
23 18
24 def self.find_next 19 def self.find_next
25 find( 20 includes(:node)
26 :all, 21 .where("start_time > ?", Time.now)
27 :limit => 1, 22 .limit(1)
28 :include => :node,
29 :conditions => ["start_time > ?", Time.now]
30 )
31 end 23 end
32 24
33 # Deletes all Occurrences which belong to the given event. Afterwards a few 25 # Deletes all Occurrences which belong to the given event. Afterwards a few
34 # variables are set to save repetitive queries. The occurrences of the given 26 # variables are set to save repetitive queries. The occurrences of the given
35 # event are then calculated and created. 27 # event are then calculated and created.