mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Default value for length in as_json fixed
The default value for length in as_json should be a multiple of EventType::LENGTH_STEP.
This commit is contained in:
parent
8388385b51
commit
a0fc9dd950
3 changed files with 3 additions and 3 deletions
|
|
@ -116,7 +116,7 @@ class Event < ActiveRecord::Base
|
||||||
|
|
||||||
json[:room_guid] = room.try(:guid)
|
json[:room_guid] = room.try(:guid)
|
||||||
json[:track_color] = track.try(:color) || '#FFFFFF'
|
json[:track_color] = track.try(:color) || '#FFFFFF'
|
||||||
json[:length] = event_type.try(:length) || 25
|
json[:length] = event_type.try(:length) || EventType::LENGTH_STEP
|
||||||
|
|
||||||
json
|
json
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,6 @@ class EventSerializer < ActiveModel::Serializer
|
||||||
|
|
||||||
# FIXME: duplicated logic from Event#as_json
|
# FIXME: duplicated logic from Event#as_json
|
||||||
def length
|
def length
|
||||||
object.event_type.try(:length) || 25
|
object.event_type.try(:length) || EventType::LENGTH_STEP
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ describe Event do
|
||||||
|
|
||||||
expect(json_hash[:room_guid]).to be_nil
|
expect(json_hash[:room_guid]).to be_nil
|
||||||
expect(json_hash[:track_color]).to eq('#FFFFFF')
|
expect(json_hash[:track_color]).to eq('#FFFFFF')
|
||||||
expect(json_hash[:length]).to eq(25)
|
expect(json_hash[:length]).to eq(15)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue