Skip to content

Commit

Permalink
fix(bookings): improve update_assets
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Feb 28, 2024
1 parent dc7f379 commit 76adce6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/placeos-models/booking.cr
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ module PlaceOS::Model
end

def update_assets
asset_ids[0] = asset_id if asset_ids.size == 1
asset_ids.insert(0, asset_id) if asset_ids.empty?
@asset_id = asset_ids.first
if (single_id = self.asset_id) && !asset_ids.includes?(single_id)
asset_ids.insert(0, single_id)
@asset_ids_changed = true
end
self.asset_id = asset_ids.first
end

def asset_ids=(vals : Array(String))
Expand Down

0 comments on commit 76adce6

Please sign in to comment.