Reworked snapshot template output
All checks were successful
Build Docker Image / build (push) Successful in 34s
All checks were successful
Build Docker Image / build (push) Successful in 34s
This commit is contained in:
@@ -175,8 +175,7 @@ class SnapshotDownloader:
|
||||
params["cursor"] = cursor
|
||||
|
||||
# Add type IDs - API expects typeIDs[]=15 format
|
||||
for type_id in type_ids:
|
||||
params["typeIDs[]"] = type_id
|
||||
params["typeIDs[]"] = type_ids
|
||||
|
||||
# Build URL with parameters
|
||||
query_string = urlencode(params, doseq=True)
|
||||
@@ -192,6 +191,13 @@ class SnapshotDownloader:
|
||||
response.raise_for_status()
|
||||
data = await response.json()
|
||||
|
||||
# Log API response summary
|
||||
posts_count = len(data.get("posts", []))
|
||||
has_cursor = bool(data.get("cursor"))
|
||||
self.logger.info(
|
||||
f"API Response: status={response.status}, posts={posts_count}, has_next_page={has_cursor}"
|
||||
)
|
||||
|
||||
# Print detailed response information for debugging if enabled
|
||||
if self.debug_mode:
|
||||
page_info = f"cursor: {cursor[:20]}..." if cursor else "first page"
|
||||
@@ -202,11 +208,9 @@ class SnapshotDownloader:
|
||||
print(
|
||||
f"Response Keys: {list(data.keys()) if isinstance(data, dict) else 'Not a dict'}"
|
||||
)
|
||||
print(f"Posts count: {len(data.get('posts', []))}")
|
||||
print(f"Posts count: {posts_count}")
|
||||
print(f"Cursor: {data.get('cursor', 'None')}")
|
||||
if (
|
||||
len(data.get("posts", [])) <= 3
|
||||
): # Only print full data if few posts
|
||||
if posts_count <= 3: # Only print full data if few posts
|
||||
print("Full Response Data:")
|
||||
print(json.dumps(data, indent=2, default=str))
|
||||
print("=" * 50)
|
||||
@@ -283,6 +287,22 @@ class SnapshotDownloader:
|
||||
f"Page {page_count}: {len(snapshots)} snapshots (total: {len(all_snapshots)})"
|
||||
)
|
||||
|
||||
# Log sample of retrieved snapshots for visibility
|
||||
if snapshots:
|
||||
first = snapshots[0]
|
||||
child_name = first.get("child", {}).get("forename", "Unknown") if first.get("child") else "Unknown"
|
||||
start_time = first.get("startTime", "Unknown")[:10] if first.get("startTime") else "Unknown"
|
||||
self.logger.info(
|
||||
f" → First snapshot: child={child_name}, date={start_time}, id={first.get('id', 'N/A')[:8]}..."
|
||||
)
|
||||
if len(snapshots) > 1:
|
||||
last = snapshots[-1]
|
||||
child_name = last.get("child", {}).get("forename", "Unknown") if last.get("child") else "Unknown"
|
||||
start_time = last.get("startTime", "Unknown")[:10] if last.get("startTime") else "Unknown"
|
||||
self.logger.info(
|
||||
f" → Last snapshot: child={child_name}, date={start_time}, id={last.get('id', 'N/A')[:8]}..."
|
||||
)
|
||||
|
||||
# If no cursor returned, we've reached the end
|
||||
if not new_cursor:
|
||||
self.logger.info("Reached last page (no cursor returned)")
|
||||
@@ -296,6 +316,13 @@ class SnapshotDownloader:
|
||||
break
|
||||
|
||||
self.logger.info(f"Total snapshots fetched: {len(all_snapshots)}")
|
||||
|
||||
# Log summary of date range covered
|
||||
if all_snapshots:
|
||||
dates = [s.get("startTime", "")[:10] for s in all_snapshots if s.get("startTime")]
|
||||
if dates:
|
||||
self.logger.info(f"Date range in results: {min(dates)} to {max(dates)}")
|
||||
|
||||
return all_snapshots
|
||||
|
||||
async def format_snapshot_html(
|
||||
|
||||
Reference in New Issue
Block a user