perf(zone): replace OpenStruct by a Struct label model
This commit is contained in:
parent
a0e64151d5
commit
4408f0f4fb
2 changed files with 2 additions and 1 deletions
1
app/models/label_model.rb
Normal file
1
app/models/label_model.rb
Normal file
|
@ -0,0 +1 @@
|
|||
LabelModel = Struct.new(:id, :label, keyword_init: true)
|
|
@ -19,7 +19,7 @@ class Zone < ApplicationRecord
|
|||
def self.available_at(date, without_zones = [])
|
||||
(Zone.all - without_zones).filter { |zone| zone.available_at?(date) }.sort_by { |zone| zone.label_at(date) }
|
||||
.map do |zone|
|
||||
OpenStruct.new(id: zone.id, label: zone.label_at(date))
|
||||
LabelModel.new(id: zone.id, label: zone.label_at(date))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue