Fixed incorrect overlap detection
This commit is contained in:
@@ -300,7 +300,14 @@ class FreeRoomsAction(AlpineBitsAction):
|
|||||||
# Validate date range
|
# Validate date range
|
||||||
start_date, end_date = self._parse_date_range(sac.start, sac.end)
|
start_date, end_date = self._parse_date_range(sac.start, sac.end)
|
||||||
|
|
||||||
|
# Check if this inventory entry has any counts (available rooms)
|
||||||
|
# Entries without counts represent unavailable rooms
|
||||||
|
has_availability = inventory.inv_counts is not None and inventory.inv_counts.inv_count
|
||||||
|
|
||||||
# Check for overlap with closing seasons
|
# Check for overlap with closing seasons
|
||||||
|
# Only entries with availability (counts) cannot overlap with closing seasons
|
||||||
|
# Entries without counts (unavailable rooms) can overlap with closing seasons
|
||||||
|
if has_availability:
|
||||||
for closing_start, closing_end in closing_season_ranges:
|
for closing_start, closing_end in closing_season_ranges:
|
||||||
if self._date_ranges_overlap(start_date, end_date, closing_start, closing_end):
|
if self._date_ranges_overlap(start_date, end_date, closing_start, closing_end):
|
||||||
error_message = f"Inventory entry ({start_date} to {end_date}) overlaps with closing season ({closing_start} to {closing_end})"
|
error_message = f"Inventory entry ({start_date} to {end_date}) overlaps with closing season ({closing_start} to {closing_end})"
|
||||||
|
|||||||
549
tests/test_data/ClosingSeasons.xml
Normal file
549
tests/test_data/ClosingSeasons.xml
Normal file
@@ -0,0 +1,549 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<!--
|
||||||
|
Bespielfile von Sebastian zum testen der Closing Seasons Funktionalität
|
||||||
|
-->
|
||||||
|
<OTA_HotelInvCountNotifRQ xmlns='http://www.opentravel.org/OTA/2003/05' Version='3.000' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.opentravel.org/OTA/2003/05 OTA_HotelInvCountNotifRQ.xsd'>
|
||||||
|
<UniqueID Type='16' ID='1' Instance='CompleteSet'/>
|
||||||
|
<Inventories HotelCode='TESTHOTEL'>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' AllInvCode='1'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='106' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='106' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='106' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-09' InvCode='107' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-10' End='2025-12-19' InvCode='107' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='107' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2025-12-28' InvCode='107' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-29' End='2026-01-04' InvCode='107' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2026-01-05' End='2026-01-31' InvCode='107' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='108' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='108' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='108' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='206' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='206' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='206' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='207' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='207' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='207' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='208' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='208' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='208' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='306' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='306' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='306' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='307' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='307' InvTypeCode='EZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='307' InvTypeCode='EZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='101' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='101' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='101' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2026-01-31' InvCode='102' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='103' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='103' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='103' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='104' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='104' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-04' InvCode='104' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2026-01-05' End='2026-01-05' InvCode='104' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2026-01-06' End='2026-01-31' InvCode='104' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='105' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='105' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='105' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='201' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='201' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='201' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='202' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='202' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='202' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='203' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='203' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='203' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='204' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='204' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='204' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='205' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2026-01-05' InvCode='205' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2026-01-06' End='2026-01-31' InvCode='205' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='301' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='301' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='301' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='302' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='302' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='302' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='303' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='303' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='303' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='304' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-25' InvCode='304' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2026-01-31' InvCode='304' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='305' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='305' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='305' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='501' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='501' InvTypeCode='DZ'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='501' InvTypeCode='DZ'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-11' InvCode='109' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-12' End='2025-12-24' InvCode='109' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-25' End='2025-12-25' InvCode='109' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-26' End='2025-12-26' InvCode='109' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-27' End='2026-01-13' InvCode='109' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2026-01-14' End='2026-01-14' InvCode='109' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2026-01-15' End='2026-01-31' InvCode='109' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-16' InvCode='110' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-17' End='2025-12-23' InvCode='110' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='110' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-17' InvCode='209' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-18' End='2025-12-23' InvCode='209' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='209' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='210' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='210' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='210' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='309' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='309' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='309' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='310' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='310' InvTypeCode='SUI'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='310' InvTypeCode='SUI'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='401' InvTypeCode='FW'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='401' InvTypeCode='FW'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='401' InvTypeCode='FW'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='402' InvTypeCode='FW'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='402' InvTypeCode='FW'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='402' InvTypeCode='FW'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='403' InvTypeCode='FW'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='403' InvTypeCode='FW'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='403' InvTypeCode='FW'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-09' End='2025-12-19' InvCode='308' InvTypeCode='COD'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-20' End='2025-12-23' InvCode='308' InvTypeCode='COD'/>
|
||||||
|
</Inventory>
|
||||||
|
<Inventory>
|
||||||
|
<StatusApplicationControl Start='2025-12-24' End='2026-01-31' InvCode='308' InvTypeCode='COD'/>
|
||||||
|
<InvCounts>
|
||||||
|
<InvCount CountType='2' Count='1'/>
|
||||||
|
</InvCounts>
|
||||||
|
</Inventory>
|
||||||
|
</Inventories>
|
||||||
|
</OTA_HotelInvCountNotifRQ>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import pytest_asyncio
|
import pytest_asyncio
|
||||||
@@ -231,6 +232,36 @@ async def test_closing_season_entries_marked_correctly(db_session: AsyncSession)
|
|||||||
assert len(closing_rows) == 2
|
assert len(closing_rows) == 2
|
||||||
assert all(row.bookable_type_2 is None for row in closing_rows)
|
assert all(row.bookable_type_2 is None for row in closing_rows)
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_closing_seasons_test_file(db_session: AsyncSession):
|
||||||
|
await insert_test_hotel(db_session)
|
||||||
|
action = make_action()
|
||||||
|
|
||||||
|
Path(__file__).parent / "test_data" / "ClosingSeasons.xml"
|
||||||
|
|
||||||
|
xml = (Path(__file__).parent / "test_data" / "ClosingSeasons.xml").read_text()
|
||||||
|
|
||||||
|
response = await action.handle(
|
||||||
|
"OTA_HotelInvCountNotif:FreeRooms",
|
||||||
|
xml,
|
||||||
|
Version.V2024_10,
|
||||||
|
make_client_info(),
|
||||||
|
db_session,
|
||||||
|
)
|
||||||
|
assert response.status_code == HttpStatusCode.OK, f"Response was not OK {response.xml_content}"
|
||||||
|
|
||||||
|
inventories = (await db_session.execute(select(HotelInventory))).scalars().all()
|
||||||
|
closing_inventory = next(inv for inv in inventories if inv.inv_type_code == "__CLOSE")
|
||||||
|
assert closing_inventory.inv_code is None
|
||||||
|
|
||||||
|
rows = (
|
||||||
|
await db_session.execute(select(RoomAvailability).order_by(RoomAvailability.date))
|
||||||
|
).scalars().all()
|
||||||
|
closing_rows = [row for row in rows if row.is_closing_season]
|
||||||
|
# Closing season from 2025-12-20 to 2025-12-23 = 4 days
|
||||||
|
assert len(closing_rows) == 4
|
||||||
|
assert all(row.bookable_type_2 is None for row in closing_rows)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_closing_season_not_allowed_in_delta(db_session: AsyncSession):
|
async def test_closing_season_not_allowed_in_delta(db_session: AsyncSession):
|
||||||
|
|||||||
Reference in New Issue
Block a user