Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Updates bat libraries
Browse files Browse the repository at this point in the history
Resolves #13509

Auditors:

Test Plan:
  • Loading branch information
NejcZdovc committed Mar 20, 2018
1 parent 827544c commit 712045d
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 48 deletions.
22 changes: 21 additions & 1 deletion app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2325,10 +2325,30 @@ const run = (state, delayTime) => {

if (data) {
let weights = []

let map = {}
data.forEach((datum) => {
map[datum.publisherKey] = {
publisherKey: datum.publisherKey,
verified: datum.verified,
exclude: datum.exclude,
score: datum.score,
pinPercentage: datum.pinPercentage,
percentage: datum.percentage,
votes: 0,
weight: datum.weight
}

weights.push({publisher: datum.publisherKey, weight: datum.weight / 100.0})
})
winners = synopsis.winners(ballots, weights)

winners = synopsis.winners(ballots, weights) || []

winners.forEach((winner) => {
if (map[winner]) map[winner].votes++
})

client.memo('run:ballots', Object.values(map))
}

if (!winners) winners = []
Expand Down
155 changes: 110 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
"aphrodite": "1.1.0",
"async": "^2.0.1",
"bat-balance": "^1.0.7",
"bat-client": "^2.0.11",
"bat-publisher": "^2.0.13",
"bat-client": "^2.1.1",
"bat-publisher": "^2.0.15",
"bignumber.js": "^4.0.4",
"bloodhound-js": "brave/bloodhound",
"clipboard-copy": "^1.0.0",
Expand Down

0 comments on commit 712045d

Please sign in to comment.