Lines
90.91 %
Functions
25 %
Branches
100 %
//! The balance report's reader: an empty `as-of` is today, which the form then shows.
use forms::REPORT_BALANCE;
use rpc::forms::Outcome;
use server::command::ReportData;
use uuid::Uuid;
use super::query::{Asked, ask_form};
use crate::response::WebError;
pub async fn ask(
user_id: Uuid,
pairs: Vec<(String, String)>,
) -> Result<Asked<ReportData>, WebError> {
ask_form(user_id, pairs, &REPORT_BALANCE, pick).await
}
fn pick(outcome: Outcome) -> Option<ReportData> {
match outcome {
Outcome::Balance(data) => Some(data),
_ => None,