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

Merge branch 'dev' for release 2.5.13

This commit is contained in:
Sylvain 2017-09-11 16:39:53 +02:00
commit 1cf2dc6f09
3 changed files with 16 additions and 6 deletions

View File

@ -1 +1 @@
2.5.12
2.5.13

View File

@ -1,9 +1,13 @@
# Changelog Fab Manager
## v2.5.13 2017 September 11
- Fix a bug: ActiveRecord::RecordNotFound when running rake task fix:recursive_events_over_DST with recursive events which the initial event was deleted
## v2.5.12 2017 September 11
- Fix a bug: Long words overflow from homepage's events blocks
- Fix a bug: ActiveRecord::RecordNotFound when running rake task fix:recursive_events_over_DST
- Fix a bug: ActiveRecord::RecordNotFound when running rake task fix:recursive_events_over_DST with non-recursive events
## v2.5.11 2017 September 7

View File

@ -60,11 +60,12 @@ namespace :fablab do
task recursive_events_over_DST: :environment do
include ApplicationHelper
failed_ids = []
groups = Event.group(:recurrence_id).count
groups.keys.each do |recurrent_event_id|
if recurrent_event_id
initial_event = Event.find(recurrent_event_id)
if initial_event
begin
initial_event = Event.find(recurrent_event_id)
Event.where(recurrence_id: recurrent_event_id).where.not(id: recurrent_event_id).each do |event|
availability = event.availability
if initial_event.availability.start_at.hour != availability.start_at.hour
@ -73,11 +74,16 @@ namespace :fablab do
availability.save!
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"
rescue ActiveRecord::RecordNotFound
failed_ids.push recurrent_event_id
end
end
end
if failed_ids.size > 0
puts "WARNING: The events with IDs #{failed_ids} were not found.\n These were initial events of a recurrence.\n\n You may have to correct the following events manually (IDs): "
puts "#{Events.where(recurrence_id: failed_ids).map(&:id)}"
end
end
end
end