Skip to content

Commit

Permalink
Merge pull request #4 from dhis2/year-bugfix
Browse files Browse the repository at this point in the history
[DHIS2-6489] Dynamic generation of years in period dropdown
  • Loading branch information
Erik Arenhill authored Mar 29, 2019
2 parents 49f1091 + c716d26 commit f0b9934
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "immunization-analysis",
"description": "Immunization data analysis app for DHIS2",
"version": "1.0.2",
"version": "1.0.3",
"dependencies": {
"angular": "^1.5.5",
"angular-animate": "^1.5.5",
Expand Down
14 changes: 12 additions & 2 deletions src/report/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1597,8 +1597,18 @@ report.controller("ReportController",


//Period options
self.periods = [{"displayName": "2018", "id": "2018"}, {"displayName": "2017", "id": "2017"}, {"displayName": "2016", "id": "2016"},{"displayName": "2015", "id": "2015"},
{"displayName": "2014", "id": "2014"},{"displayName": "2013", "id": "2013"}];
self.periods = [];

let currentYear = new Date().getFullYear();
//Show years from now, back to 2013
while ( currentYear >= 2013 ) {
self.periods.push({
displayName: currentYear.toString(),
id: currentYear.toString()
});
--currentYear;
}

self.selectedPeriod = self.periods[0];


Expand Down

0 comments on commit f0b9934

Please sign in to comment.