Skip to content

Commit

Permalink
feat: return default commit id in votes/candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
liorfrenkel committed Mar 30, 2020
1 parent 02f54ff commit fd5b2de
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions server/components/api/votes/votesBLL.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const createQueryObject = require('../../../lib/createQueryObject');
const config = require('../../../config/Config');

const configAfterTallyBlocks = config.get('governance:afterTallyBlocks');
const configDefaultCommitId = config.get('governance:defaultCommitId');
// number of blocks to show tally results
const AFTER_TALLY_BLOCKS = configAfterTallyBlocks ? Number(configAfterTallyBlocks) : 1000;

Expand Down Expand Up @@ -137,9 +138,16 @@ module.exports = {
return null;
}

return votesDAL.findContestantWinners({
interval: currentInterval.interval,
});
return votesDAL
.findContestantWinners({
interval: currentInterval.interval,
})
// add the default commit id to the list if it does not exist
.then(results =>
results.some(candidate => candidate.commitId === configDefaultCommitId)
? results
: [{ commitId: configDefaultCommitId, zpAmount: '0' }, ...results]
);
},
};

Expand Down

0 comments on commit fd5b2de

Please sign in to comment.