diff --git a/src/main/manifest.webapp b/src/main/manifest.webapp index ba33a41..00e2a56 100644 --- a/src/main/manifest.webapp +++ b/src/main/manifest.webapp @@ -1 +1 @@ -{"version":"0.2.6","name":"Data Approval","description":"Approvals app for PEPFAR","icons":{"48":"img/icons/dataapproval.png"},"developer":{"url":"http://www.dhis2.org","name":"Mark Polak","company":"DHIS2 Core Team","email":"markpo@ifi.uio.no"},"launch_path":"index.html","default_locale":"en","activities":{"dhis":{"href":"*"}}} \ No newline at end of file +{"version":"0.2.7","name":"Data Approval","description":"Approvals app for PEPFAR","icons":{"48":"img/icons/dataapproval.png"},"developer":{"url":"http://www.dhis2.org","name":"Mark Polak","company":"DHIS2 Core Team","email":"markpo@ifi.uio.no"},"launch_path":"index.html","default_locale":"en","activities":{"dhis":{"href":"*"}}} \ No newline at end of file diff --git a/src/main/period/period-service.js b/src/main/period/period-service.js index e7647c2..315f0e6 100644 --- a/src/main/period/period-service.js +++ b/src/main/period/period-service.js @@ -82,10 +82,17 @@ function periodService(d2Api) { } //Show this years and last years quarters - if (/^Quarterly|SixMonthly/.test(currentPeriodType)) { + if (/^Quarterly$/.test(currentPeriodType)) { var thisYear = dhis2.period.generator.generateReversedPeriods(currentPeriodType, 0); - var lastYear = dhis2.period.generator.generateReversedPeriods(currentPeriodType, -1); - generatedPeriods = thisYear.concat(lastYear); + + var currentQuarter = dhis2.period.generator.filterFuturePeriodsExceptCurrent(thisYear); + thisYear = thisYear.slice((3 - currentQuarter.length >= 0) ? 3 - currentQuarter.length : 0); + + var oneYearAgo = dhis2.period.generator.generateReversedPeriods(currentPeriodType, -1); + var twoYearsAgo = dhis2.period.generator.generateReversedPeriods(currentPeriodType, -2); + var threeYearsAgo = dhis2.period.generator.generateReversedPeriods(currentPeriodType, -3); + + generatedPeriods = thisYear.concat(oneYearAgo).concat(twoYearsAgo).concat(threeYearsAgo); return; }