mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
[bug] the count of successfully updated events was not correct
This commit is contained in:
parent
436db80ccf
commit
390f62fd41
@ -7,6 +7,7 @@
|
|||||||
- Increased the width of the input field for the prices of the events
|
- Increased the width of the input field for the prices of the events
|
||||||
- Fix a bug: the notification sent to the project author when a collaborator has confirmed his participation is not sent
|
- Fix a bug: the notification sent to the project author when a collaborator has confirmed his participation is not sent
|
||||||
- Fix a bug: the event themes are not kept when editing the event again
|
- Fix a bug: the event themes are not kept when editing the event again
|
||||||
|
- Fix a bug: the count of successfully updated events was not correct
|
||||||
- Fix a security issue: updated underscore to 1.12.1 to fix [CVE-2021-23358](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23358)
|
- Fix a security issue: updated underscore to 1.12.1 to fix [CVE-2021-23358](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23358)
|
||||||
- Fix a security issue: updated lodash to 4.17.21 to fix [CVE-2021-23337](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23337)
|
- Fix a security issue: updated lodash to 4.17.21 to fix [CVE-2021-23337](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23337)
|
||||||
- Fix a security issue: updated url-parse to 1.5.1 to fix [CVE-2021-27515](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-27515)
|
- Fix a security issue: updated url-parse to 1.5.1 to fix [CVE-2021-27515](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-27515)
|
||||||
|
@ -64,7 +64,9 @@ class API::EventsController < API::ApiController
|
|||||||
def update
|
def update
|
||||||
authorize Event
|
authorize Event
|
||||||
res = EventService.update(@event, event_params.permit!, params[:edit_mode])
|
res = EventService.update(@event, event_params.permit!, params[:edit_mode])
|
||||||
render json: { action: 'update', total: res.length, updated: res.select { |r| r[:status] }.length, details: res }, status: :ok, location: @event
|
render json: { action: 'update', total: res[:events].length, updated: res[:events].select { |r| r[:status] }.length, details: res },
|
||||||
|
status: :ok,
|
||||||
|
location: @event
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -102,7 +102,10 @@ class EventService
|
|||||||
private
|
private
|
||||||
|
|
||||||
def update_events(event, events, event_params)
|
def update_events(event, events, event_params)
|
||||||
results = []
|
results = {
|
||||||
|
events: [],
|
||||||
|
slots: []
|
||||||
|
}
|
||||||
events.each do |e|
|
events.each do |e|
|
||||||
next unless e.id != event.id
|
next unless e.id != event.id
|
||||||
|
|
||||||
@ -164,18 +167,18 @@ class EventService
|
|||||||
event_files_attributes: ef_attributes
|
event_files_attributes: ef_attributes
|
||||||
)
|
)
|
||||||
begin
|
begin
|
||||||
results.push status: !!e.update(e_params.permit!), event: e # rubocop:disable Style/DoubleNegation
|
results[:events].push status: !!e.update(e_params.permit!), event: e # rubocop:disable Style/DoubleNegation
|
||||||
rescue StandardError => err
|
rescue StandardError => err
|
||||||
results.push status: false, event: e, error: err.try(:record).try(:class).try(:name), message: err.message
|
results[:events].push status: false, event: e, error: err.try(:record).try(:class).try(:name), message: err.message
|
||||||
end
|
end
|
||||||
results.concat(update_slots(e.availability_id))
|
results[:slots].concat(update_slots(e.availability_id))
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
results.push status: !!event.update(event_params), event: event # rubocop:disable Style/DoubleNegation
|
results[:events].push status: !!event.update(event_params), event: event # rubocop:disable Style/DoubleNegation
|
||||||
rescue StandardError => err
|
rescue StandardError => err
|
||||||
results.push status: false, event: event, error: err.try(:record).try(:class).try(:name), message: err.message
|
results[:events].push status: false, event: event, error: err.try(:record).try(:class).try(:name), message: err.message
|
||||||
end
|
end
|
||||||
results.concat(update_slots(event.availability_id))
|
results[:slots].concat(update_slots(event.availability_id))
|
||||||
results
|
results
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user