Skip to content

Commit

Permalink
Add check to reload data on datasetgroup change
Browse files Browse the repository at this point in the history
When updating the dataset group to a different group
that has the same period id the table did not reload
with the new mechanisms. When the dataset group is now
changed the period is checked if it has stayed the same
if it has then the table is updated.

References jqueipo/DATIM#663
  • Loading branch information
Markionium committed Aug 25, 2015
1 parent c032a5b commit 14150ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/main/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ function appController(periodService, $scope, currentUser, mechanismsService,

//When the dataset group is changed update the filter types and the datasets
$scope.$on('DATASETGROUP.changed', function (event, dataSets) {
periodService.filterPeriodTypes(dataSets.getPeriodTypes());
var oldPeriods = periodService.getPeriodTypes();
var newPeriods = periodService.filterPeriodTypes(dataSets.getPeriodTypes());

$scope.details.dataSets = dataSets.get();
mechanismsService.categories = dataSets.getCategoryIds();
Expand All @@ -412,6 +413,11 @@ function appController(periodService, $scope, currentUser, mechanismsService,
if (self.hasTableDetails()) {
self.showData = false;
self.deSelect();

//When the periodType has not changed, force a reload of the table since the dataset group changed
if (oldPeriods.length && newPeriods.length && oldPeriods[0] === newPeriods[0]) {
self.getTableData();
}
}

self.updateViewButton();
Expand Down
2 changes: 1 addition & 1 deletion src/main/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"0.4.2","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":"[email protected]"},"launch_path":"index.html?v=0.4.2","default_locale":"en","activities":{"dhis":{"href":"*"}}}
{"version":"0.4.3","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":"[email protected]"},"launch_path":"index.html?v=0.4.3","default_locale":"en","activities":{"dhis":{"href":"*"}}}

0 comments on commit 14150ef

Please sign in to comment.