andyw8-acts_as_event_owner 1.1.11 → 1.1.13
Sign up to get free protection for your applications and to get access to all the features.
data/README.textile
CHANGED
@@ -7,6 +7,7 @@ Reasons for this fork:
|
|
7
7
|
* Fix compatibility with Rails >= 3.09 (https://github.com/dburkes/acts_as_event_owner/issues/14)
|
8
8
|
* Use Bundler instead of Jeweler for gem releases (Jeweler appears to be abandoned)
|
9
9
|
* Add CI via Travis
|
10
|
+
* The rake task for `acts_as_event_owner:generate_events` appeared incomplete/broken. I've fixed it for the simplified case I need where no arguments are required, and it will default to events from now to 30 days in the future.
|
10
11
|
|
11
12
|
One test was failing for me, which I don't have time to look into at the moment (event_specificiation_spec.rb) so I have marked it as pending.
|
12
13
|
|
@@ -98,8 +98,9 @@ module ActsAsEventOwner
|
|
98
98
|
raise ActsAsEventOwner::Exception.new("Invalid Event Specification") if !valid?
|
99
99
|
|
100
100
|
opts = options.clone
|
101
|
-
opts[:from]
|
102
|
-
|
101
|
+
opts[:from] = Time.now
|
102
|
+
|
103
|
+
opts[:to] ||= (opts[:from] + 90.days) if opts[:from]
|
103
104
|
opts[:from] -= 1.second
|
104
105
|
opts[:to] -= 1.second
|
105
106
|
opts[:from] = opts[:to] = nil if opts[:count]
|
@@ -128,15 +129,15 @@ module ActsAsEventOwner
|
|
128
129
|
additional[column] = self.attributes[column] if @@OCCURRENCE_COLUMNS.include?(column)
|
129
130
|
additional
|
130
131
|
end
|
131
|
-
|
132
|
+
|
132
133
|
# puts "*********** #{occurrence.start_time} : #{occurrence.start_time.zone}"
|
133
134
|
# puts "*********** #{Time.zone.at(occurrence.start_time.to_i)}"
|
134
|
-
|
135
|
+
|
135
136
|
hash = {
|
136
137
|
:owner_id => self.owner_id, :owner_type => self.owner_type, :event_specification_id => self.id,
|
137
138
|
:description => occurrence.description, :start_at => occurrence.start_time.utc,
|
138
139
|
:end_at => occurrence.finish_time.utc}.stringify_keys.merge(additional_columns).merge(attribute_overrides.stringify_keys)
|
139
|
-
|
140
|
+
|
140
141
|
EventOccurrence.find_or_create_by_owner_id_and_owner_type_and_event_specification_id_and_start_at_and_end_at(hash)
|
141
142
|
end
|
142
143
|
end
|
@@ -146,7 +147,7 @@ module ActsAsEventOwner
|
|
146
147
|
spec.generate_events(options)
|
147
148
|
}
|
148
149
|
end
|
149
|
-
|
150
|
+
|
150
151
|
def repeat
|
151
152
|
self.attributes["repeat"].try(:to_sym)
|
152
153
|
end
|
@@ -1,14 +1,6 @@
|
|
1
1
|
namespace :acts_as_event_owner do
|
2
|
-
task :require_from do
|
3
|
-
raise "Set FROM to something understandable by Time.parse" if !ENV['FROM']
|
4
|
-
end
|
5
|
-
|
6
|
-
task :require_to do
|
7
|
-
raise "Set TO to something understandable by Time.parse" if !ENV['TO']
|
8
|
-
end
|
9
|
-
|
10
2
|
desc "Generate all events within a certain time window"
|
11
|
-
task :generate_events => [:environment
|
12
|
-
ActsAsEventOwner::EventSpecification.all(:conditions => "until IS NULL OR until >= '#{Time.zone.now.to_s(:db)}'").each {|spec| spec.generate_events
|
3
|
+
task :generate_events => [:environment] do
|
4
|
+
ActsAsEventOwner::EventSpecification.all(:conditions => "until IS NULL OR until >= '#{Time.zone.now.to_s(:db)}'").each {|spec| spec.generate_events}
|
13
5
|
end
|
14
|
-
end
|
6
|
+
end
|