diff options
Diffstat (limited to 'src/api/events.rs')
| -rw-r--r-- | src/api/events.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/api/events.rs b/src/api/events.rs index bd6db70..496a077 100644 --- a/src/api/events.rs +++ b/src/api/events.rs @@ -17,6 +17,7 @@ use serde_json::{Value as JsonValue, json}; use super::auth::AuthenticatedUser; use super::{ApiError, error_response, store_status}; +use crate::federation::client; use crate::federation::fold::Federation; use crate::federation::fork; use crate::federation::jcs::Json as Jcs; @@ -124,7 +125,9 @@ 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, the votes on it, the parties -/// voting `true` and `false`, and whether it passed and whether it is dead. +/// voting `true` and `false`, whether it passed and whether it is dead, and why a party's +/// client backs it not, where it is no version that can be written on the current one +/// (`client::backable`). async fn counts(State(state): State<AppState>) -> Response { with_store(&state, |store| { let read = store.state(); @@ -152,6 +155,9 @@ async fn counts(State(state): State<AppState>) -> Response { .into_iter() .map(|(hash, ballot)| { let tally = read.tally(current, &hash); + let none = read + .proposal(&hash) + .and_then(|proposed| client::backable(current, proposed).err()); ( hash.to_string(), json!({ @@ -161,6 +167,7 @@ async fn counts(State(state): State<AppState>) -> Response { "no": tally.no, "passed": tally.passed, "dead": tally.dead, + "none": none, }), ) }) |
