fix(events): guard booking_occupancy when booking table missing
CI / test (push) Successful in 6m45s
CI / deploy-ift (push) Successful in 4m5s
CI / e2e-ift (push) Successful in 9m0s
CI / deploy-stage (push) Successful in 2m36s
CI / e2e-stage (push) Successful in 1m18s

Admin eunit suites call event_to_json without Mnesia booking table;
catch list_by_event failures and treat as free.
This commit is contained in:
2026-07-30 15:56:49 +03:00
parent edd396dff8
commit bb37909ffb
+8 -1
View File
@@ -345,9 +345,16 @@ event_to_json(Event) ->
}.
%% @doc Активная занятость слота для сетки commercial (Studio aggregate).
%% Safe if Mnesia booking table is not ready (admin/unit tests without full schema).
-spec booking_occupancy(#event{}) -> free | pending | confirmed.
booking_occupancy(#event{id = EventId, start_time = Start}) ->
{ok, Bookings} = core_booking:list_by_event(EventId),
Bookings =
try
{ok, List} = core_booking:list_by_event(EventId),
List
catch
_:_ -> []
end,
Now = calendar:universal_time(),
lists:foldl(
fun(#booking{status = confirmed}, _Acc) ->