Skip to content
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

fix: update sort params to correctly sort #222

Merged
merged 2 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ exports[`FavoritePositionsComponent matches snapshot 1`] = `
},
Object {
"text": "TED: Soonest",
"value": "position__current_assignment__estimated_end_date",
"value": "ted",
},
Object {
"text": "Position number: Low to high",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports[`SelectForm matches snapshot 1`] = `
Posted date: Most recent
</option>
<option
value="position__current_assignment__estimated_end_date"
value="ted"
>
TED: Soonest
</option>
Expand Down Expand Up @@ -106,7 +106,7 @@ exports[`SelectForm matches snapshot when disabled 1`] = `
Posted date: Most recent
</option>
<option
value="position__current_assignment__estimated_end_date"
value="ted"
>
TED: Soonest
</option>
Expand Down
8 changes: 3 additions & 5 deletions src/Constants/Sort.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { COMMON_PROPERTIES } from './EndpointParams';

export const POSITION_SEARCH_SORTS = {
options: [
{ value: '', text: 'Sort option', disabled: true },
{ value: 'position__title', text: 'Position title: A-Z' },
{ value: '-position__grade', text: 'Grade: Low to high' }, // sort by grade "ranking"
{ value: '-position__bureau', text: 'Bureau: A-Z' }, // numbers first, then A-Z
{ value: `-${COMMON_PROPERTIES.posted}`, text: 'Posted date: Most recent' }, // sort by soonest posted_date
{ value: 'position__current_assignment__estimated_end_date', text: 'TED: Soonest' },
{ value: '-posted_date', text: 'Posted date: Most recent' }, // sort by soonest posted_date
{ value: 'ted', text: 'TED: Soonest' },
{ value: 'position__position_number', text: 'Position number: Low to high' }, // numbers first, then A-Z
{ value: '-position__post__has_service_needs_differential', text: 'Featured positions' }, // sort by service needs first
],
};

POSITION_SEARCH_SORTS.defaultSort = POSITION_SEARCH_SORTS.options.find(o =>
o.value === 'position__current_assignment__estimated_end_date',
o.value === 'ted',
).value;

export const POSITION_PAGE_SIZES = {
Expand Down