mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Delete Eventschedules out of conference hours
This commit is contained in:
parent
b3bbaf87a4
commit
bde2ee3d7d
1 changed files with 10 additions and 0 deletions
|
|
@ -82,6 +82,7 @@ module Admin
|
|||
short_title = @conference.short_title
|
||||
@conference.assign_attributes(conference_params)
|
||||
send_mail_on_conf_update = @conference.notify_on_dates_changed?
|
||||
delete_event_schedules if @conference.start_hour_changed? || @conference.end_hour_changed?
|
||||
|
||||
if @conference.update_attributes(conference_params)
|
||||
ConferenceDateUpdateMailJob.perform_later(@conference) if send_mail_on_conf_update
|
||||
|
|
@ -188,5 +189,14 @@ module Admin
|
|||
:targets, :targets_attributes,
|
||||
:campaigns, :campaigns_attributes, :registration_limit)
|
||||
end
|
||||
|
||||
def delete_event_schedules
|
||||
event_schedules = EventSchedule.select do |e|
|
||||
e.start_time.strftime('%H').to_i < @conference.start_hour ||
|
||||
e.end_time.strftime('%H').to_i > @conference.end_hour ||
|
||||
(e.end_time.strftime('%H').to_i == @conference.end_hour && e.end_time.strftime('%M').to_i > 0)
|
||||
end
|
||||
event_schedules.each(&:destroy)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue