Filter recent requests by resolved display stage before pagination
Magent CI/CD / verify (push) Successful in 1m52s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Skipped

This commit is contained in:
2026-09-13 12:28:52 +12:00
parent e3332bec1f
commit dcd8082c8d
3 changed files with 58 additions and 9 deletions
+18 -6
View File
@@ -2760,14 +2760,17 @@ async def recent_requests(
status_codes = request_stage_filter_codes(stage)
if _recent_cache_stale():
_refresh_recent_cache_from_db()
# Jellyfin can promote working requests to ready. Filter the displayed
# stage before pagination, including working candidates in the ready view.
candidate_codes = [4, 5] if status_codes == [4] else status_codes
take = max(1, min(int(take), 200))
skip = max(0, int(skip))
rows = _get_recent_from_cache(
requested_by,
requested_by_id,
take,
skip,
since_iso,
status_codes=status_codes,
requested_by, requested_by_id,
len(_recent_cache.get("items") or []), 0, since_iso,
status_codes=candidate_codes,
)
matched = 0
cache_mode = (runtime.artwork_cache_mode or "remote").lower()
allow_title_hydrate = False
allow_artwork_hydrate = client.configured()
@@ -2880,6 +2883,13 @@ async def recent_requests(
jellyfin_cache,
)
status_label = _status_label_with_jellyfin(status, is_available)
if status_label == STATUS_LABELS[4]:
status = 4
if status_codes and status not in status_codes:
continue
matched += 1
if matched <= skip:
continue
results.append(
{
"id": row.get("request_id"),
@@ -2896,6 +2906,8 @@ async def recent_requests(
},
}
)
if len(results) >= take:
break
return {"results": results}