Paginate the admin review queue (and flagged list)
CI/CD / CI · dotnet build (push) Successful in 1m59s
CI/CD / Deploy · hamkadr (push) Successful in 3m3s

The «صف بررسی» loaded every New/Flagged RawListing at once — endless scroll once a crawl fills
it. Page both at 20/row with «قبلی/بعدی» controls (independent q & f query params); the header
now shows the true totals, not the page size.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-21 18:42:36 +03:30
parent 7bbb4e385e
commit cdb58eeb86
2 changed files with 41 additions and 7 deletions
@@ -26,6 +26,13 @@ public class IndexModel : PageModel
public List<RawListing> Queue { get; private set; } = new();
public List<RawListing> Flagged { get; private set; } = new();
public const int PageSize = 20;
public int QueuePage { get; private set; } = 1;
public int QueueTotal { get; private set; }
public int FlaggedPage { get; private set; } = 1;
public int FlaggedTotal { get; private set; }
public int QueuePages => Math.Max(1, (int)Math.Ceiling(QueueTotal / (double)PageSize));
public int FlaggedPages => Math.Max(1, (int)Math.Ceiling(FlaggedTotal / (double)PageSize));
public IReadOnlyList<string> SourceNames { get; private set; } = new List<string>();
public int PublishedShifts { get; private set; }
public int PublishedJobs { get; private set; }
@@ -36,7 +43,7 @@ public class IndexModel : PageModel
[TempData] public string? IngestMessage { get; set; }
public async Task OnGetAsync() => await LoadAsync();
public async Task OnGetAsync(int q = 1, int f = 1) => await LoadAsync(q, f);
public async Task<IActionResult> OnPostAddAsync()
{
@@ -166,14 +173,21 @@ public class IndexModel : PageModel
return RedirectToPage();
}
private async Task LoadAsync()
private async Task LoadAsync(int q = 1, int f = 1)
{
QueueTotal = await _db.RawListings.CountAsync(r => r.Status == RawListingStatus.New);
QueuePage = Math.Clamp(q, 1, QueuePages);
Queue = await _db.RawListings
.Where(r => r.Status == RawListingStatus.New)
.OrderByDescending(r => r.Confidence).ThenByDescending(r => r.FetchedAt).ToListAsync();
.OrderByDescending(r => r.Confidence).ThenByDescending(r => r.FetchedAt)
.Skip((QueuePage - 1) * PageSize).Take(PageSize).ToListAsync();
FlaggedTotal = await _db.RawListings.CountAsync(r => r.Status == RawListingStatus.Flagged);
FlaggedPage = Math.Clamp(f, 1, FlaggedPages);
Flagged = await _db.RawListings
.Where(r => r.Status == RawListingStatus.Flagged)
.OrderByDescending(r => r.FetchedAt).ToListAsync();
.OrderByDescending(r => r.FetchedAt)
.Skip((FlaggedPage - 1) * PageSize).Take(PageSize).ToListAsync();
SourceNames = _ingest.SourceNames;
PublishedShifts = await _db.Shifts.CountAsync(s => s.Source != ShiftSource.Direct);
PublishedJobs = await _db.JobOpenings.CountAsync();