1
//! The category report's reader: empty dates are this month so far, which the form then shows.
2

            
3
use forms::REPORT_CATEGORY;
4
use rpc::forms::Outcome;
5
use server::command::BreakdownData;
6
use uuid::Uuid;
7

            
8
use super::query::{Asked, ask_form};
9
use crate::response::WebError;
10

            
11
41
pub async fn ask(
12
41
    user_id: Uuid,
13
41
    pairs: Vec<(String, String)>,
14
41
) -> Result<Asked<BreakdownData>, WebError> {
15
41
    ask_form(user_id, pairs, &REPORT_CATEGORY, pick).await
16
41
}
17

            
18
34
fn pick(outcome: Outcome) -> Option<BreakdownData> {
19
34
    match outcome {
20
34
        Outcome::Breakdown(data) => Some(data),
21
        _ => None,
22
    }
23
34
}