diff options
Diffstat (limited to 'src/api/events.rs')
| -rw-r--r-- | src/api/events.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/api/events.rs b/src/api/events.rs index 9fa8786..b388acc 100644 --- a/src/api/events.rs +++ b/src/api/events.rs @@ -111,7 +111,8 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons /// `GET /events/counts`: what counts, as the store reads now: the current version, each /// party's keys and nodes, the values at places, the members, and the proposals on the -/// current version, each with the events proposing it and the votes on it. +/// current version, each with the events proposing it, the votes on it, the parties +/// voting `true` and `false`, and whether it passed and whether it is dead. async fn counts(State(state): State<AppState>) -> Response { with_store(&state, |store| { let read = store.state(); @@ -138,9 +139,17 @@ async fn counts(State(state): State<AppState>) -> Response { .ballots(¤t.hash) .into_iter() .map(|(hash, ballot)| { + let tally = read.tally(current, &hash); ( hash.to_string(), - json!({"proposals": ids(ballot.proposals), "votes": ids(ballot.votes)}), + json!({ + "proposals": ids(ballot.proposals), + "votes": ids(ballot.votes), + "yes": tally.yes, + "no": tally.no, + "passed": tally.passed, + "dead": tally.dead, + }), ) }) .collect(); |
