Przeglądaj źródła

Fix rooms_to_sell type normalization in calendar parse

Booking.com may return rooms_to_sell as a JSON string rather than a
number. int() was missing, causing "0" != 0 (True in Python 3) and
making _rts_issues report every non-None date as a drift issue even
when actual and expected values looked identical in the output.
ZiB 4 miesięcy temu
rodzic
commit
e2a66065dc
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      room_cal/service_api/_booking.py

+ 1 - 1
room_cal/service_api/_booking.py

@@ -482,7 +482,7 @@ class _BookingClient:
           price=round(float(price_str)) if price_str else None,
           available=(info.get('hidden', 0) == 0),
           booked=(info.get('net_booked', 0) > 0),
-          rooms_to_sell=info.get('rooms_to_sell', 0),
+          rooms_to_sell=int(info.get('rooms_to_sell') or 0),
         )
     else:
       # Partner availability API: only rate-level dates; status encodes availability