db_modeling_for_capi #5
@@ -5,7 +5,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import UTC, date, datetime
|
from datetime import date, datetime
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -419,6 +419,16 @@ async def process_wix_form_submission(request: Request, data: dict[str, Any], db
|
|||||||
or "Frangart Inn" # fallback
|
or "Frangart Inn" # fallback
|
||||||
)
|
)
|
||||||
|
|
||||||
|
submissionTime = data.get("submissionTime") # 2025-10-07T05:48:41.855Z
|
||||||
|
try:
|
||||||
|
if submissionTime:
|
||||||
|
submissionTime = datetime.fromisoformat(
|
||||||
|
submissionTime[:-1]
|
||||||
|
) # Remove Z and convert
|
||||||
|
except Exception as e:
|
||||||
|
_LOGGER.error("Error parsing submissionTime: %s", e)
|
||||||
|
submissionTime = None
|
||||||
|
|
||||||
reservation = ReservationData(
|
reservation = ReservationData(
|
||||||
unique_id=unique_id,
|
unique_id=unique_id,
|
||||||
start_date=date.fromisoformat(start_date),
|
start_date=date.fromisoformat(start_date),
|
||||||
@@ -429,7 +439,7 @@ async def process_wix_form_submission(request: Request, data: dict[str, Any], db
|
|||||||
hotel_code=hotel_code,
|
hotel_code=hotel_code,
|
||||||
hotel_name=hotel_name,
|
hotel_name=hotel_name,
|
||||||
offer=offer,
|
offer=offer,
|
||||||
created_at=datetime.now(UTC),
|
created_at=submissionTime,
|
||||||
utm_source=data.get("field:utm_source"),
|
utm_source=data.get("field:utm_source"),
|
||||||
utm_medium=data.get("field:utm_medium"),
|
utm_medium=data.get("field:utm_medium"),
|
||||||
utm_campaign=data.get("field:utm_campaign"),
|
utm_campaign=data.get("field:utm_campaign"),
|
||||||
|
|||||||
Reference in New Issue
Block a user