merge_db_fixes_to_main #16
@@ -42,7 +42,7 @@ select res.id, res.created_at, con.created_at as "Con Created at", con.updated_a
|
|||||||
left join alpinebits.conversions as con on con.reservation_id = res.id
|
left join alpinebits.conversions as con on con.reservation_id = res.id
|
||||||
left join alpinebits.conversion_guests as g on g.guest_id = con.guest_id
|
left join alpinebits.conversion_guests as g on g.guest_id = con.guest_id
|
||||||
|
|
||||||
where hotel_code = '39054_001'
|
where hotel_id = '39054_001'
|
||||||
|
|
||||||
|
|
||||||
order by res.created_at desc limit 400
|
order by res.created_at desc limit 400
|
||||||
|
|||||||
@@ -1197,7 +1197,7 @@ async def _process_conversion_xml_background(
|
|||||||
# Now process the conversion XML
|
# Now process the conversion XML
|
||||||
_LOGGER.info("Starting database processing of %s", filename)
|
_LOGGER.info("Starting database processing of %s", filename)
|
||||||
conversion_service = ConversionService(session_maker, hotel.hotel_id)
|
conversion_service = ConversionService(session_maker, hotel.hotel_id)
|
||||||
processing_stats = await conversion_service.process_conversion_xml(xml_content)
|
processing_stats = await conversion_service.process_conversion_xml(xml_content, run_full_guest_matching=True)
|
||||||
|
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"Conversion processing complete for %s: %s", filename, processing_stats
|
"Conversion processing complete for %s: %s", filename, processing_stats
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -142,7 +142,7 @@ class TestConversionServiceWithImportedData:
|
|||||||
|
|
||||||
## Need to check if reservations and customers are now actually available in the db before proceeding
|
## Need to check if reservations and customers are now actually available in the db before proceeding
|
||||||
|
|
||||||
conversion_service = ConversionService(test_db_session)
|
conversion_service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await conversion_service.process_conversion_xml(xml_content)
|
stats = await conversion_service.process_conversion_xml(xml_content)
|
||||||
|
|
||||||
# BASELINE ASSERTIONS:
|
# BASELINE ASSERTIONS:
|
||||||
@@ -224,7 +224,7 @@ class TestConversionServiceWithImportedData:
|
|||||||
# File already has proper XML structure, just use it as-is
|
# File already has proper XML structure, just use it as-is
|
||||||
xml_content = xml_content.strip()
|
xml_content = xml_content.strip()
|
||||||
|
|
||||||
conversion_service = ConversionService(test_db_session)
|
conversion_service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await conversion_service.process_conversion_xml(xml_content)
|
stats = await conversion_service.process_conversion_xml(xml_content)
|
||||||
|
|
||||||
# Verify conversions were created
|
# Verify conversions were created
|
||||||
@@ -300,7 +300,7 @@ class TestConversionServiceWithImportedData:
|
|||||||
# File already has proper XML structure, just use it as-is
|
# File already has proper XML structure, just use it as-is
|
||||||
xml_content = xml_content.strip()
|
xml_content = xml_content.strip()
|
||||||
|
|
||||||
conversion_service = ConversionService(test_db_session)
|
conversion_service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await conversion_service.process_conversion_xml(xml_content)
|
stats = await conversion_service.process_conversion_xml(xml_content)
|
||||||
|
|
||||||
# Verify conversions were processed
|
# Verify conversions were processed
|
||||||
@@ -332,7 +332,7 @@ class TestConversionServiceWithImportedData:
|
|||||||
"""Test ConversionService handles invalid XML gracefully."""
|
"""Test ConversionService handles invalid XML gracefully."""
|
||||||
invalid_xml = "<invalid>unclosed tag"
|
invalid_xml = "<invalid>unclosed tag"
|
||||||
|
|
||||||
conversion_service = ConversionService(test_db_session)
|
conversion_service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
|
|
||||||
with pytest.raises(ValueError, match="Invalid XML"):
|
with pytest.raises(ValueError, match="Invalid XML"):
|
||||||
await conversion_service.process_conversion_xml(invalid_xml)
|
await conversion_service.process_conversion_xml(invalid_xml)
|
||||||
@@ -342,7 +342,7 @@ class TestConversionServiceWithImportedData:
|
|||||||
"""Test ConversionService handles empty/minimal XML."""
|
"""Test ConversionService handles empty/minimal XML."""
|
||||||
minimal_xml = '<?xml version="1.0"?><root></root>'
|
minimal_xml = '<?xml version="1.0"?><root></root>'
|
||||||
|
|
||||||
conversion_service = ConversionService(test_db_session)
|
conversion_service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await conversion_service.process_conversion_xml(minimal_xml)
|
stats = await conversion_service.process_conversion_xml(minimal_xml)
|
||||||
|
|
||||||
assert stats["total_reservations"] == 0
|
assert stats["total_reservations"] == 0
|
||||||
@@ -421,7 +421,7 @@ class TestConversionServiceWithImportedData:
|
|||||||
xml_content1 = multi_builder1.build_xml()
|
xml_content1 = multi_builder1.build_xml()
|
||||||
|
|
||||||
# Process first batch
|
# Process first batch
|
||||||
service = ConversionService(test_db_session)
|
service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats1 = await service.process_conversion_xml(xml_content1)
|
stats1 = await service.process_conversion_xml(xml_content1)
|
||||||
|
|
||||||
assert stats1["total_reservations"] == 2
|
assert stats1["total_reservations"] == 2
|
||||||
@@ -577,7 +577,7 @@ class TestXMLBuilderUsage:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Process the XML
|
# Process the XML
|
||||||
service = ConversionService(test_db_session)
|
service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await service.process_conversion_xml(xml_content)
|
stats = await service.process_conversion_xml(xml_content)
|
||||||
|
|
||||||
assert stats["total_reservations"] == 1
|
assert stats["total_reservations"] == 1
|
||||||
@@ -616,7 +616,7 @@ class TestXMLBuilderUsage:
|
|||||||
.build_xml()
|
.build_xml()
|
||||||
)
|
)
|
||||||
|
|
||||||
service = ConversionService(test_db_session)
|
service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await service.process_conversion_xml(xml_content)
|
stats = await service.process_conversion_xml(xml_content)
|
||||||
|
|
||||||
assert stats["total_reservations"] == 1
|
assert stats["total_reservations"] == 1
|
||||||
@@ -677,7 +677,7 @@ class TestXMLBuilderUsage:
|
|||||||
xml_content = multi_builder.build_xml()
|
xml_content = multi_builder.build_xml()
|
||||||
|
|
||||||
# Process the XML
|
# Process the XML
|
||||||
service = ConversionService(test_db_session)
|
service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await service.process_conversion_xml(xml_content)
|
stats = await service.process_conversion_xml(xml_content)
|
||||||
|
|
||||||
assert stats["total_reservations"] == 2
|
assert stats["total_reservations"] == 2
|
||||||
@@ -768,7 +768,7 @@ class TestHashedMatchingLogic:
|
|||||||
</reservation>
|
</reservation>
|
||||||
</root>"""
|
</root>"""
|
||||||
|
|
||||||
service = ConversionService(test_db_session, hotel_id="hotel_1")
|
service = ConversionService(test_db_session, hotel_id="39054_001")
|
||||||
stats = await service.process_conversion_xml(xml_content)
|
stats = await service.process_conversion_xml(xml_content)
|
||||||
|
|
||||||
# Verify conversion was created
|
# Verify conversion was created
|
||||||
|
|||||||
Reference in New Issue
Block a user