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 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
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ exports[`FavoritePositionsComponent matches snapshot 1`] = `
},
Object {
"text": "Grade: Low to high",
"value": "-position__grade",
"value": "position__grade",
},
Object {
"text": "Bureau: A-Z",
"value": "-position__bureau",
"value": "position__bureau",
},
Object {
"text": "Posted date: Most recent",
"value": "-posted_date",
"value": "posted_date",
},
Object {
"text": "TED: Soonest",
"value": "position__current_assignment__estimated_end_date",
"value": "ted",
},
Object {
"text": "Position number: Low to high",
Expand Down
16 changes: 8 additions & 8 deletions src/Components/SelectForm/__snapshots__/SelectForm.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ exports[`SelectForm matches snapshot 1`] = `
Position title: A-Z
</option>
<option
value="-position__grade"
value="position__grade"
>
Grade: Low to high
</option>
<option
value="-position__bureau"
value="position__bureau"
>
Bureau: A-Z
</option>
<option
value="-posted_date"
value="posted_date"
>
Posted date: Most recent
</option>
<option
value="position__current_assignment__estimated_end_date"
value="ted"
>
TED: Soonest
</option>
Expand Down Expand Up @@ -91,22 +91,22 @@ exports[`SelectForm matches snapshot when disabled 1`] = `
Position title: A-Z
</option>
<option
value="-position__grade"
value="position__grade"
>
Grade: Low to high
</option>
<option
value="-position__bureau"
value="position__bureau"
>
Bureau: A-Z
</option>
<option
value="-posted_date"
value="posted_date"
>
Posted date: Most recent
</option>
<option
value="position__current_assignment__estimated_end_date"
value="ted"
>
TED: Soonest
</option>
Expand Down
12 changes: 5 additions & 7 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: 'position__grade', text: 'Grade: Low to high' }, // sort by grade "ranking"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually be -position__grade, as "06" is logically the "lowest" grade.

{ value: 'position__bureau', text: 'Bureau: A-Z' }, // numbers first, then A-Z

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting W's first for this one

{ 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