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

            
3
use forms::REPORT_ACTIVITY;
4
use rpc::forms::Outcome;
5
use server::command::ActivityData;
6
use uuid::Uuid;
7

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

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

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