First Version EAV Importer. feat: Enhance activity detail retrieval with EAV metrics and refactor activity import logic
- Updated the `get_activity_detail` function to include session metrics in the activity detail output, allowing for enriched data representation. - Refactored the activity import logic to streamline the process of inserting and updating activity records, utilizing new helper functions for better maintainability. - Improved the handling of duplicate activity entries by implementing a more robust identification mechanism. - Enhanced the metadata for activity detail registration to reflect the inclusion of EAV metrics and updated source tables.
This commit is contained in:
1 parent
c6e8371d5a
commit
934b915357
8 files changed
+550
-361
No files matched your search
@@ -249,11 +249,18 @@ def test_run_universal_import_activity_garmin_time_plus_date_columns(monkeypatch
|
||||
cur = _SeqCursor([None, {"id": new_id}])
|
||||
out = run_universal_csv_import(cur, PID, "activity", text, "garmin.csv", mapping)
|
||||
assert out["rows_imported"] == 1
|
||||
# Duplicate-Key muss Datum + kombinierte Startzeit enthalten
|
||||
assert any(
|
||||
params and "2024-01-20 08:30:00" in str(params)
|
||||
# Duplicate-Check: Datum + TIME, IS NOT DISTINCT FROM (kein String-Vergleich für start_time)
|
||||
dup_sqls = [
|
||||
(_sql, params)
|
||||
for _sql, params in cur.executes
|
||||
if params
|
||||
if params and "IS NOT DISTINCT FROM" in _sql and "activity_log" in _sql
|
||||
]
|
||||
assert dup_sqls, f"erwarteter Duplicate-SELECT fehlt; executes={cur.executes!r}"
|
||||
assert any(
|
||||
len(p) >= 3
|
||||
and str(p[1]).startswith("2024-01-20")
|
||||
and (getattr(p[2], "hour", None) == 8 and getattr(p[2], "minute", None) == 30)
|
||||
for _, p in dup_sqls
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user