diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-24 04:13:16 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-24 04:13:16 +0200 |
| commit | e0a7e0fec760ba12c8067a37e10c96f1f05876e2 (patch) | |
| tree | d0cf745592a46aee4d4913911fd34c7c24515220 /app/models/occurrence.rb | |
| parent | 6424e10be5a89f175a74c71c55660412a169b8b8 (diff) | |
Stage 1 complete: Rails 2.3.5 to Rails 3.2.22.5 upgrade
- Converted plugins to gems (Gemfile)
- Updated config structure (application.rb, boot.rb, environment.rb)
- Converted routes to Rails 3 DSL
- Converted named_scope to scope throughout models
- Converted find(:all, :conditions) to where() chains
- Fixed has_many :order to use ordering scope
- Updated session store and secret token configuration
- Fixed exception_notification middleware configuration
- Patched Ruby 2.4 / Rails 3.2 incompatibilities:
- Integer/Float duration arithmetic (ActiveSupport)
- Arel visit_Integer for PostgreSQL adapter
- create_database String/Integer coercion
- ActionController consider_all_requests_local
- Migrated taggings schema for acts-as-taggable-on
- Replaced dynamic_form gem with custom form_error_messages helper
- Fixed Rails 3 block helper syntax (form_for, form_tag, fields_for)
- Fixed admin layout yield
- Updated test suite for Rails 3 APIs
Diffstat (limited to 'app/models/occurrence.rb')
| -rw-r--r-- | app/models/occurrence.rb | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/app/models/occurrence.rb b/app/models/occurrence.rb index 62432d5..0760d5e 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. |
