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

Commit

Permalink
Adds new logic from the ledger-publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Mar 23, 2017
1 parent 4239016 commit 2bf1018
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1692,9 +1692,16 @@ var run = (delayTime) => {

if ((typeof delayTime === 'undefined') || (!client)) return

var active, state
var active, state, weights, winners
var ballots = client.ballots()
var winners = ((synopsis) && (ballots > 0) && (synopsis.winners(ballots))) || []
var data = (synopsis) && (ballots > 0) && synopsisNormalizer()

if (data) {
weights = []
data.forEach((datum) => { weights.push({ publisher: datum.site, weight: datum.weight / 100.0 }) })
winners = synopsis.winners(ballots, weights)
}
if (!winners) winners = []

try {
winners.forEach((winner) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"ledger-balance": "^0.8.64",
"ledger-client": "^0.8.133",
"ledger-geoip": "^0.8.75",
"ledger-publisher": "^0.8.124",
"ledger-publisher": "^0.9.0",
"lru-cache": "^1.0.0",
"moment": "^2.15.1",
"niceware": "^1.0.4",
Expand Down

0 comments on commit 2bf1018

Please sign in to comment.