Skip to content

Conversation

@ronnyReliefapp
Copy link

Description

This PR fixes a bug in the dynamic GraphQL all resolver that prevented sorting on nested resource fields within dashboards. The issue was most noticeable in the "Supporting Documents" dashboard where sorting by columns like "Biosphere Reserve" or "Related form" did not work as expected.

The root cause was two-fold:

  1. The aggregation pipeline's projection stage was incorrectly discarding populated resource fields because it only preserved fields within the data namespace.
  2. The sort aggregation helper did not correctly handle nested field paths (e.g., related_biosphere.a_01_1_name_in_english) sent by the frontend for sorting.

This PR corrects the projection logic to ensure linked resource data is available for sorting and enhances the sort aggregation to correctly apply sorting on these nested fields.

Useful links

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (refactor or addition to existing functionality)

How Has This Been Tested?

This change was tested by following these steps:

  1. Navigate to the "Supporting Documents" dashboard
  2. Click on the "Biosphere Reserve" column header to sort in ascending/descending order.
  3. Verification: The grid now correctly sorts the records alphabetically by the biosphere reserve's name. The same test was performed for the "Related form" column.

Screenshots

NA

Checklist:

( * == Mandatory )

  • - I have set myself as assignee of the pull request
  • - My code follows the style guidelines of this project
  • - Linting does not generate new warnings
  • - I have performed a self-review of my own code
  • - I have put the ticket for review, adding the oort-backend team to the list of reviewers
  • - I have commented my code, particularly in hard-to-understand areas
  • - I have put JSDoc comment in all required places
  • - My changes generate no new warnings
  • - I have included screenshots describing my changes if relevant
  • - I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

More explanation

https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145

@ronnyReliefapp ronnyReliefapp changed the title feat(dashboard): fix sorting on resource fields MAB 477 Update columns of supporting documents dashboard to include country and BR ID Nov 12, 2025
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.

3 participants