Skip to content

Commit

Permalink
feat: eligibility years array in table result
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanoshadjipetrou committed Jul 11, 2024
1 parent b219db4 commit 69f3d45
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/controllers/eligibility.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export class EligibilityController {
EligibilityTableMapping.geography,
);

const years: string[] = [];

const data: {
[key: string]:
| string
Expand Down Expand Up @@ -150,6 +152,7 @@ export class EligibilityController {
);

_.forEach(componentGroupedByYear, (value, key) => {
years.push(key);
let isEligible = _.get(
value,
`[0]["${EligibilityTableMapping.isEligible}"]`,
Expand Down Expand Up @@ -184,7 +187,7 @@ export class EligibilityController {
return item;
});

return {data};
return {data, years: _.orderBy(_.uniq(years), [], ['desc'])};
})
.catch(handleDataApiError);
}
Expand Down

0 comments on commit 69f3d45

Please sign in to comment.