Skip to content

Commit

Permalink
updating election cache after executing actions on an election becaus…
Browse files Browse the repository at this point in the history
…e children election might also be affected (#281)
  • Loading branch information
edulix authored Apr 25, 2022
1 parent 6b88b27 commit 417ec60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions avAdmin/admin-directives/dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ angular.module('avAdmin')

if (c.path === 'start')
{
ElectionsApi.clearElectionCache();
Authmethod
.changeAuthEvent(scope.election.id, 'started')
.then(
Expand All @@ -177,6 +178,7 @@ angular.module('avAdmin')
);
} else if (c.path === 'stop')
{
ElectionsApi.clearElectionCache();
Authmethod
.changeAuthEvent(scope.election.id, 'stopped')
.then(
Expand All @@ -189,6 +191,7 @@ angular.module('avAdmin')
);
} else
{
ElectionsApi.clearElectionCache();
ElectionsApi
.command(scope.election, c.path, c.method, c.data)
.catch(
Expand Down
5 changes: 5 additions & 0 deletions avAdmin/elections-api-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ angular.module('avAdmin')
electionsapi.cache[id] = election;
};

electionsapi.clearElectionCache = function () {
electionsapi.cache = {};
electionsapi.permcache = {};
};

electionsapi.getElection = function(id, ignorecache, electionAuth) {
var deferred = $q.defer();

Expand Down

0 comments on commit 417ec60

Please sign in to comment.