Skip to content

Commit

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

Auditors:

Test Plan:
  • Loading branch information
NejcZdovc committed Mar 22, 2018
1 parent a776700 commit acd1971
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 49 deletions.
27 changes: 25 additions & 2 deletions app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2325,10 +2325,33 @@ const run = (state, delayTime) => {

if (data) {
let weights = []

let map = {}
data.forEach((datum) => {
weights.push({publisher: datum.publisherKey, weight: datum.weight / 100.0})
map[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,
pinPercentage: datum.pinPercentage,
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 acd1971

Please sign in to comment.