Skip to content

Commit 9f7b1a4

Browse files
committed
feat(place/bookings): expose room_capacity for analytics
1 parent 471c85e commit 9f7b1a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/place/bookings.cr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class Place::Bookings < PlaceOS::Driver
8484
@sensor_stale_minutes : Time::Span = 8.minutes
8585
@perform_sensor_search : Bool = true
8686
@sensor_mac : String? = nil
87+
@room_capacity : Int32 = 0
8788

8889
def on_update
8990
schedule.clear
@@ -154,7 +155,7 @@ class Place::Bookings < PlaceOS::Driver
154155
# Write to redis last on the off chance there is a connection issue
155156
control_sys = config.control_system.not_nil!
156157
self[:room_name] = setting?(String, :room_name).presence || control_sys.display_name.presence || control_sys.name
157-
self[:room_capacity] = setting?(Int32, :room_capacity) || control_sys.capacity
158+
self[:room_capacity] = @room_capacity = setting?(Int32, :room_capacity) || control_sys.capacity || 0
158159
self[:default_title] = @default_title
159160
self[:disable_book_now_host] = @disable_book_now_host
160161
self[:disable_book_now] = @disable_book_now
@@ -446,6 +447,7 @@ class Place::Bookings < PlaceOS::Driver
446447
ending_at: ending_at_calc,
447448
event_title: booking["title"]?,
448449
event_host: host_details,
450+
room_capacity: @room_capacity,
449451
}
450452

451453
@expose_for_analytics.each do |binding, path|

0 commit comments

Comments
 (0)