1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

[bug]ActiveRecord::RecordNotFound during fix:recursive_events_over_DST

This commit is contained in:
Sylvain 2017-09-11 10:39:40 +02:00
parent 75cb28e401
commit 8ac716af55
3 changed files with 18 additions and 8 deletions

View File

@ -1 +1 @@
2.5.11 2.5.12-dev

View File

@ -1,5 +1,9 @@
# Changelog Fab Manager # Changelog Fab Manager
## next release
- Fix a bug: ActiveRecord::RecordNotFound when running rake task fix:recursive_events_over_DST
## v2.5.11 2017 September 7 ## v2.5.11 2017 September 7
- Added tooltip concerning images insertion while configuring the about page - Added tooltip concerning images insertion while configuring the about page

View File

@ -62,7 +62,9 @@ namespace :fablab do
include ApplicationHelper include ApplicationHelper
groups = Event.group(:recurrence_id).count groups = Event.group(:recurrence_id).count
groups.keys.each do |recurrent_event_id| groups.keys.each do |recurrent_event_id|
if recurrent_event_id
initial_event = Event.find(recurrent_event_id) initial_event = Event.find(recurrent_event_id)
if initial_event
Event.where(recurrence_id: recurrent_event_id).where.not(id: recurrent_event_id).each do |event| Event.where(recurrence_id: recurrent_event_id).where.not(id: recurrent_event_id).each do |event|
availability = event.availability availability = event.availability
if initial_event.availability.start_at.hour != availability.start_at.hour if initial_event.availability.start_at.hour != availability.start_at.hour
@ -71,6 +73,10 @@ namespace :fablab do
availability.save! availability.save!
end end
end end
else
puts "Error: The initial event (id: #{recurrent_event_id}) of the recurrence was not found. You may have to correct events manually"
end
end
end end
end end
end end