Skip to content

fix: fixed the weekly file table sorting issue#404

Merged
plakkara-bc merged 9 commits into
devfrom
fix/weekly-file-sort
Jul 2, 2026
Merged

fix: fixed the weekly file table sorting issue#404
plakkara-bc merged 9 commits into
devfrom
fix/weekly-file-sort

Conversation

@plakkara-bc

Copy link
Copy Markdown
Contributor

Description

Summary of Changes

1. Weekly Summary Table - Backend Sorting (Full Dataset)

Problem: Sorting Weekly File Date / CSA Processing Date only sorted the current page, not the entire list.

Solution:

  • Frontend (WeeklyFileProcessingTab.tsx): Now passes sort parameter to getWeeklyFiles() API call and resets to page 1 when sort changes.
  • Frontend service (weekly-files-service.ts): Added sort parameter support to getWeeklyFiles().
  • Backend controller (weekly-files.controller.ts): Added sort query parameter to GET /weekly-files.
  • Backend service (weekly-files.service.ts): Implemented server-side sorting before pagination for weeklyFileDate and csaProcessingDate.

2. Unified Sort Parser (Backend Refactor)

Problem: Two nearly identical sort parser functions existed for summary and details tables.

Solution: Created one generic function in weekly-files.service.ts:

function parseWeeklySort<T extends string>(
  sort: string | undefined,
  allowedColumns: readonly T[],
): { column: T; direction: 'asc' | 'desc' } | null

Both tables now use this single parser with their respective allowlists:

  • Weekly Summary: ALLOWED_WEEKLY_SUMMARY_SORT_COLUMNS
  • Weekly Details: ALLOWED_WEEKLY_RECORD_SORT_COLUMNS

Result

Table Sorting Scope Uses Unified Parser
Weekly Summary Full dataset ✅
Weekly Details Full dataset ✅
Child Search Current page (unchanged) N/A

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Automated/Unit tests
  • Manual tests (description below)
  • No new tests are required

Checklist

  • I have tested my changed locally
  • The code builds and pass all tests, No warning
  • I have made corresponding changes to the documentation

In Progress/Follow Up

Comment thread frontend/src/components/WeeklyFileProcessingTab.tsx Fixed
@plakkara-bc
plakkara-bc requested a review from mdiapenabc July 2, 2026 15:37
@plakkara-bc
plakkara-bc merged commit 387f551 into dev Jul 2, 2026
21 checks passed
@plakkara-bc
plakkara-bc deleted the fix/weekly-file-sort branch July 2, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants