Skip to content

Commit

Permalink
Add necessary fields from #117 into comparison cards
Browse files Browse the repository at this point in the history
  • Loading branch information
mjoyce91 committed Jul 18, 2017
1 parent cf0ada3 commit 86f03da
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Components/CompareList/CompareList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ class CompareList extends Component {
}

render() {
const { compare } = this.props;
// TODO - move language list to its own component, as this is used in multiple places
const languageList = (compare.languages && compare.languages.length)
? compare.languages.map(choice => (
`${choice.language} `
)) : AlertMessages.NO_LANGUAGES;
return (
<div>
{ this.props.compare.map(result => (
Expand All @@ -31,11 +37,21 @@ class CompareList extends Component {
Bureau: {result.bureau}
<br />
Organization: {result.organization}
<br />
Tour of Duty: {result.post && result.post.tour_of_duty ?
result.post.tour_of_duty : AlertMessages.NO_TOUR_OF_DUTY}
<br />
Language: <span>{languageList}</span>
<br />
Post: {result.post ? <Link to={`/post/${result.post.id}`}>{result.post.description}</Link> : AlertMessages.NO_POST }
<br />
Post Differential: {result.post
Post Differential: {result.post && result.post.differential_rate
? result.post.differential_rate : AlertMessages.NO_POST_DIFFERENTIAL}
<br />
Danger Pay: {result.post ? result.post.danger_pay : AlertMessages.NO_DANGER_PAY}
<br />
COLA: {result.post && result.post.cola ?
result.cost_of_living_adjustment : AlertMessages.NO_COLA}
</p>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/Constants/AlertMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ export const NO_LANGUAGES = 'None listed';
export const NO_POST = 'None listed';
export const NO_POST_DIFFERENTIAL = 'None listed';
export const NO_DANGER_PAY = 'None listed';
export const NO_COLA = 'None listed';
export const NO_TOUR_OF_DUTY = 'None listed';
8 changes: 8 additions & 0 deletions src/Constants/AlertMessages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ describe('AlertMessages', () => {
it('Should return NO_DANGER_PAY', () => {
expect(AlertMessages.NO_DANGER_PAY).toBeDefined();
});

it('Should return NO_COLA', () => {
expect(AlertMessages.NO_COLA).toBeDefined();
});

it('Should return NO_TOUR_OF_DUTY', () => {
expect(AlertMessages.NO_TOUR_OF_DUTY).toBeDefined();
});
});

0 comments on commit 86f03da

Please sign in to comment.