mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
fix create event without custom price + fix test fixtures
This commit is contained in:
parent
4f41aa6554
commit
ea73b9a88b
@ -88,9 +88,11 @@ class API::EventsController < API::ApiController
|
||||
# convert main price to centimes
|
||||
event_preparams.merge!(amount: (event_preparams[:amount].to_i * 100 if event_preparams[:amount].present?))
|
||||
# delete non-complete "other" prices and convert them to centimes
|
||||
event_preparams[:event_price_categories_attributes].delete_if { |price_cat| price_cat[:price_category_id].empty? or price_cat[:amount].empty? }
|
||||
event_preparams[:event_price_categories_attributes].each do |price_cat|
|
||||
price_cat[:amount] = price_cat[:amount].to_i * 100
|
||||
unless event_preparams[:event_price_categories_attributes].nil?
|
||||
event_preparams[:event_price_categories_attributes].delete_if { |price_cat| price_cat[:price_category_id].empty? or price_cat[:amount].empty? }
|
||||
event_preparams[:event_price_categories_attributes].each do |price_cat|
|
||||
price_cat[:amount] = price_cat[:amount].to_i * 100
|
||||
end
|
||||
end
|
||||
# return the resulting params object
|
||||
event_preparams
|
||||
|
8
test/fixtures/price_categories.yml
vendored
8
test/fixtures/price_categories.yml
vendored
@ -1,9 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
description: MyText
|
||||
name: "- de 25 ans"
|
||||
conditions: "Tarif réservé aux jeunes de moins de 25 ans"
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
description: MyText
|
||||
name: "chômeurs"
|
||||
conditions: "Tarif préférentiel pour les demandeurs d'emploi pouvant justifier de leur situation."
|
||||
|
Loading…
x
Reference in New Issue
Block a user