|
|
|
@@ -175,6 +175,20 @@ async def _fetch_tracks_for_tracker( |
|
|
|
tracker_id: str, |
|
|
|
params: Optional[dict] = None, |
|
|
|
) -> List[dict]: |
|
|
|
query_params = dict(params or {}) |
|
|
|
query_params["id"] = tracker_id |
|
|
|
|
|
|
|
try: |
|
|
|
payload = await _core_get_json(client, "/reslevis/getTracks", params=query_params) |
|
|
|
if not isinstance(payload, list): |
|
|
|
raise HTTPException(status_code=502, detail="Unexpected CORE response type") |
|
|
|
direct_rows = [_normalize_track(row) for row in payload if isinstance(row, dict)] |
|
|
|
if direct_rows: |
|
|
|
return direct_rows |
|
|
|
except HTTPException as exc: |
|
|
|
if exc.status_code != 404: |
|
|
|
raise |
|
|
|
|
|
|
|
payload = await _core_get_json(client, f"/reslevis/getTracks/{tracker_id}", params=params) |
|
|
|
if not isinstance(payload, list): |
|
|
|
raise HTTPException(status_code=502, detail="Unexpected CORE response type") |
|
|
|
@@ -191,7 +205,9 @@ async def _fetch_all_tracks(params: dict) -> List[dict]: |
|
|
|
payload = await _core_get_json(client, "/reslevis/getTracks", params=params) |
|
|
|
if not isinstance(payload, list): |
|
|
|
raise HTTPException(status_code=502, detail="Unexpected CORE response type") |
|
|
|
return [_normalize_track(row) for row in payload if isinstance(row, dict)] |
|
|
|
direct_rows = [_normalize_track(row) for row in payload if isinstance(row, dict)] |
|
|
|
if direct_rows: |
|
|
|
return direct_rows |
|
|
|
except HTTPException as exc: |
|
|
|
if exc.status_code != 404: |
|
|
|
raise |
|
|
|
|