mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(bug) unable to update recurrent events
This commit is contained in:
parent
4185b6e2fd
commit
6d9b4b2c70
@ -1,5 +1,7 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Fix a bug: unable to update recurrent events
|
||||
|
||||
## v5.7.1 2023 February 20
|
||||
|
||||
- Fix a bug: timezone is ignored while configuring calendar opening/closing time
|
||||
|
@ -89,9 +89,9 @@ class Event::UpdateEventService
|
||||
)
|
||||
end
|
||||
|
||||
ef_attributes = file_attributes(base_event, occurrence, event_params)
|
||||
e_params.merge(
|
||||
event_files_attributes: ef_attributes
|
||||
event_files_attributes: file_attributes(base_event, occurrence, event_params),
|
||||
event_image_attributes: image_attributes(occurrence, event_params)
|
||||
)
|
||||
end
|
||||
|
||||
@ -137,5 +137,15 @@ class Event::UpdateEventService
|
||||
end
|
||||
ef_attributes
|
||||
end
|
||||
|
||||
# @param occurrence [Event]
|
||||
# @param event_params [ActionController::Parameters]
|
||||
def image_attributes(occurrence, event_params)
|
||||
if event_params['event_image_attributes'].nil? || event_params['event_image_attributes']['id'].present?
|
||||
{ id: occurrence.event_image&.id }
|
||||
else
|
||||
event_params['event_image_attributes']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -96,6 +96,9 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
|
||||
event: {
|
||||
title: event.title,
|
||||
description: event.description,
|
||||
event_image_attributes: {
|
||||
id: event.event_image.id
|
||||
},
|
||||
category_id: 2,
|
||||
event_theme_ids: [1],
|
||||
age_range_id: 1,
|
||||
@ -122,6 +125,10 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
|
||||
assert res_event[:status]
|
||||
db_event = Event.find(res_event[:event][:id])
|
||||
assert_equal 2, db_event.category_id
|
||||
assert FileUtils.compare_file(
|
||||
File.join(ActionDispatch::IntegrationTest.fixture_path, new_image),
|
||||
db_event.event_image.attachment.file.path
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user