andyw8-acts_as_event_owner 1.1.16 → 1.1.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -98,7 +98,7 @@ module ActsAsEventOwner
98
98
  raise ActsAsEventOwner::Exception.new("Invalid Event Specification") if !valid?
99
99
 
100
100
  opts = options.clone
101
- opts[:from] ||= self.start_at
101
+ opts[:from] ||= Time.now
102
102
  opts[:to] ||= (opts[:from] + 30.days) if opts[:from]
103
103
  opts[:from] -= 1.second
104
104
  opts[:to] -= 1.second
@@ -128,15 +128,15 @@ module ActsAsEventOwner
128
128
  additional[column] = self.attributes[column] if @@OCCURRENCE_COLUMNS.include?(column)
129
129
  additional
130
130
  end
131
-
131
+
132
132
  # puts "*********** #{occurrence.start_time} : #{occurrence.start_time.zone}"
133
133
  # puts "*********** #{Time.zone.at(occurrence.start_time.to_i)}"
134
-
134
+
135
135
  hash = {
136
136
  :owner_id => self.owner_id, :owner_type => self.owner_type, :event_specification_id => self.id,
137
137
  :description => occurrence.description, :start_at => occurrence.start_time.utc,
138
138
  :end_at => occurrence.finish_time.utc}.stringify_keys.merge(additional_columns).merge(attribute_overrides.stringify_keys)
139
-
139
+
140
140
  EventOccurrence.find_or_create_by_owner_id_and_owner_type_and_event_specification_id_and_start_at_and_end_at(hash)
141
141
  end
142
142
  end
@@ -146,7 +146,7 @@ module ActsAsEventOwner
146
146
  spec.generate_events(options)
147
147
  }
148
148
  end
149
-
149
+
150
150
  def repeat
151
151
  self.attributes["repeat"].try(:to_sym)
152
152
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsEventOwner
2
- VERSION = "1.1.16" unless defined? ActsAsEventOwner::VERSION
2
+ VERSION = "1.1.17" unless defined? ActsAsEventOwner::VERSION
3
3
  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, :require_from, :require_to] do
12
- ActsAsEventOwner::EventSpecification.all(:conditions => "until IS NULL OR until >= '#{Time.zone.now.to_s(:db)}'").each {|spec| spec.generate_events(options)}
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andyw8-acts_as_event_owner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.16
4
+ version: 1.1.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: