Remove extend_pins (superseded by wyby sync)
- wyby sync covers all its cases with better data (actual booking dates instead of +-15 min window derivation) and faster reaction (15 min vs 1 h) - parse_ts moved into wyby_sync; skip logging extracted to Sync.log_skips - deploy installs only wyby-sync units
This commit is contained in:
+16
-9
@@ -128,6 +128,11 @@ class Sync:
|
||||
|
||||
# --- planning -------------------------------------------------------
|
||||
|
||||
def log_skips(self):
|
||||
for s in self.skipped:
|
||||
# PIN collisions need manual attention -> surface in the error filter
|
||||
(logger.warning if "resolve manually" in s else logger.info)("SKIP %s", s)
|
||||
|
||||
def plan_booking(self, b, group_id, today):
|
||||
ctx = f"wyby {b.number} ({b.customer}, {b.object_name})"
|
||||
if b.end_date < today:
|
||||
@@ -174,8 +179,8 @@ class Sync:
|
||||
)
|
||||
return
|
||||
current = (
|
||||
g_extend_parse(row.get("validFrom")),
|
||||
g_extend_parse(row.get("validTo")),
|
||||
parse_ts(row.get("validFrom")),
|
||||
parse_ts(row.get("validTo")),
|
||||
)
|
||||
if current != (desired_from, desired_to):
|
||||
data = {
|
||||
@@ -221,10 +226,14 @@ class Sync:
|
||||
return self.failed == 0
|
||||
|
||||
|
||||
def g_extend_parse(raw):
|
||||
from extend_pins import parse_ts
|
||||
|
||||
return parse_ts(raw)
|
||||
def parse_ts(raw):
|
||||
"""Glutz timestamp (e.g. "2026-11-12T00:00:00.000") -> naive datetime."""
|
||||
if not raw:
|
||||
return None
|
||||
try:
|
||||
return datetime.fromisoformat(str(raw))
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
def main() -> None:
|
||||
@@ -289,9 +298,7 @@ def main() -> None:
|
||||
continue
|
||||
sync.plan_booking(b, group_id, today)
|
||||
|
||||
for s in sync.skipped:
|
||||
# PIN collisions need manual attention -> surface in the error filter
|
||||
(logger.warning if "resolve manually" in s else logger.info)("SKIP %s", s)
|
||||
sync.log_skips()
|
||||
if not sync.planned:
|
||||
logger.info("No changes needed (%d bookings checked).", len(bookings))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user