Skip to content

Fix up the sortBy parameter - (Top 2364) #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix for sorting certain fields
  • Loading branch information
jmgasper committed Jul 29, 2024
commit d5d7570500ff04527f49a348a1b59f1c208a6506
12 changes: 12 additions & 0 deletions src/services/ChallengeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,18 @@ async function searchChallenges(currentUser, criteria) {
}

let sortByProp = criteria.sortBy ? criteria.sortBy : "created";

// Add '.keyword' to the end of the sort by prop for certain fields
// (TOP-2364)
if(sortByProp === "updatedBy" ||
sortByProp === "createdBy" ||
sortByProp === "name" ||
sortByProp === "type" ||
sortByProp === "status") {

sortByProp = sortByProp + ".keyword";
}

const sortOrderProp = criteria.sortOrder ? criteria.sortOrder : "desc";

const mustQuery = [];
Expand Down