Update app.py
Browse files
app.py
CHANGED
|
@@ -117,22 +117,30 @@ def _filter_records(repo: str, pr: str, sha: str) -> List[dict]:
|
|
| 117 |
repo = repo.strip().lower()
|
| 118 |
pr = pr.strip()
|
| 119 |
sha = sha.strip().lower()
|
|
|
|
|
|
|
| 120 |
|
| 121 |
if not pr:
|
| 122 |
return []
|
| 123 |
|
| 124 |
file_paths = _list_collection_files(pr)
|
|
|
|
|
|
|
| 125 |
records: List[dict] = []
|
| 126 |
for file_path in file_paths:
|
| 127 |
commit = _extract_commit_from_path(file_path)
|
| 128 |
if sha and not commit.lower().startswith(sha):
|
|
|
|
| 129 |
continue
|
| 130 |
payload = _load_payload(file_path)
|
| 131 |
if payload is None:
|
|
|
|
| 132 |
continue
|
| 133 |
metadata = payload.get("metadata") or {}
|
| 134 |
repository = (metadata.get("repository") or "").lower()
|
|
|
|
| 135 |
if repo and repo not in repository:
|
|
|
|
| 136 |
continue
|
| 137 |
payload["__source_path"] = file_path
|
| 138 |
payload["__commit"] = commit
|
|
@@ -143,6 +151,8 @@ def _filter_records(repo: str, pr: str, sha: str) -> List[dict]:
|
|
| 143 |
return metadata.get("collected_at") or ""
|
| 144 |
|
| 145 |
records.sort(key=_sort_key, reverse=True)
|
|
|
|
|
|
|
| 146 |
return records[:MAX_ROWS]
|
| 147 |
|
| 148 |
|
|
|
|
| 117 |
repo = repo.strip().lower()
|
| 118 |
pr = pr.strip()
|
| 119 |
sha = sha.strip().lower()
|
| 120 |
+
|
| 121 |
+
print(f"DEBUG: _filter_records called with repo='{repo}', pr='{pr}', sha='{sha}'")
|
| 122 |
|
| 123 |
if not pr:
|
| 124 |
return []
|
| 125 |
|
| 126 |
file_paths = _list_collection_files(pr)
|
| 127 |
+
print(f"DEBUG: Found {len(file_paths)} file paths")
|
| 128 |
+
|
| 129 |
records: List[dict] = []
|
| 130 |
for file_path in file_paths:
|
| 131 |
commit = _extract_commit_from_path(file_path)
|
| 132 |
if sha and not commit.lower().startswith(sha):
|
| 133 |
+
print(f"DEBUG: Skipping {file_path} - commit {commit} doesn't match sha {sha}")
|
| 134 |
continue
|
| 135 |
payload = _load_payload(file_path)
|
| 136 |
if payload is None:
|
| 137 |
+
print(f"DEBUG: Skipping {file_path} - failed to load payload")
|
| 138 |
continue
|
| 139 |
metadata = payload.get("metadata") or {}
|
| 140 |
repository = (metadata.get("repository") or "").lower()
|
| 141 |
+
print(f"DEBUG: File {file_path} has repository='{repository}', filtering by='{repo}'")
|
| 142 |
if repo and repo not in repository:
|
| 143 |
+
print(f"DEBUG: Skipping {file_path} - repo filter doesn't match")
|
| 144 |
continue
|
| 145 |
payload["__source_path"] = file_path
|
| 146 |
payload["__commit"] = commit
|
|
|
|
| 151 |
return metadata.get("collected_at") or ""
|
| 152 |
|
| 153 |
records.sort(key=_sort_key, reverse=True)
|
| 154 |
+
print(f"DEBUG: Returning {len(records)} records after filtering")
|
| 155 |
+
return records[:MAX_ROWS]
|
| 156 |
return records[:MAX_ROWS]
|
| 157 |
|
| 158 |
|