temptours+tours

This commit is contained in:
2025-12-09 11:27:02 -05:00
commit f28439c9bb
49 changed files with 18416 additions and 0 deletions

View File

@ -0,0 +1,85 @@
def insert_detail_record(
cur,
cnx,
con_id: int,
dossard: str,
lecture: dict,
tp_id: int,
tp_name: str,
controller_location: str,
priority: int,
controller_name: str,
dt_local,
status=1,
reason_code=None,
reason_ref_id=None,
tour=None,
tempstour=None,
tempstour_str=None # <-- AJOUT OBLIGATOIRE
):
if isinstance(dt_local, tuple):
dt_local = dt_local[1]
detail_table = f"resultv2_{con_id}_detail"
sql = f"""
INSERT INTO `{detail_table}`
(con_id, tp_id, tp_name,
cla_info_dossard, rcourse_id,
timestamp_read,
timestamp_read_local,
timestamp_read_local_str,
raw_tag,
reader_location, controller_priority,
controller_name,
source,
status, reason_code, reason_ref_id,
tour, TempsTour, tempstour_str)
VALUES (%s, %s, %s,
%s, %s,
%s,
%s,
%s,
%s,
%s, %s,
%s,
%s,
%s, %s, %s,
%s, %s, %s)
"""
timestamp_read_local_unix = f"{dt_local.timestamp():.2f}"
timestamp_read_local_str = (
f"{dt_local.strftime('%Y-%m-%d %H:%M:%S')}."
f"{dt_local.microsecond // 10000:02d}"
)
if isinstance(tempstour, tuple):
tempstour = None
data = (
con_id,
tp_id,
tp_name,
dossard,
lecture["rcourse_id"],
lecture["chrinfo_time"],
timestamp_read_local_unix,
timestamp_read_local_str,
lecture["chrinfo_tag"],
controller_location,
priority,
controller_name,
"LIVE",
status,
reason_code,
reason_ref_id,
tour,
tempstour,
tempstour_str
)
cur.execute(sql, data)
cnx.commit()