summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-09-10 13:29:14 +0200
committerhukl <contact@smyck.org>2009-09-10 13:29:14 +0200
commit8194cd82d7cb70c5b81bec8ee7a82b542c2570e9 (patch)
tree19c8feba1043492ca191dfd04d58cd513d74fe06 /app/models
parentcc401c9bf20995bc4e02ba835847a7578e727d0c (diff)
show the next event if none are found for the next 14 days. Closes #19
Diffstat (limited to 'app/models')
-rw-r--r--app/models/occurrence.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/occurrence.rb b/app/models/occurrence.rb
index 667ba6f..591e1e0 100644
--- a/app/models/occurrence.rb
+++ b/app/models/occurrence.rb
@@ -20,6 +20,15 @@ class Occurrence < ActiveRecord::Base
20 ) 20 )
21 end 21 end
22 22
23 def self.find_next
24 find(
25 :all,
26 :limit => 1,
27 :include => :node,
28 :conditions => ["start_time > ?", Time.now]
29 )
30 end
31
23 # Deletes all Occurrences which belong to the given event. Afterwards a few 32 # Deletes all Occurrences which belong to the given event. Afterwards a few
24 # variables are set to save repetitive queries. The occurrences of the given 33 # variables are set to save repetitive queries. The occurrences of the given
25 # event are then calculated and created. 34 # event are then calculated and created.