shared/domain/module/body/find_answer/
play_settings.rs

1use serde::{Deserialize, Serialize};
2
3/// Default limit for attempts a student can make on an answer before a trace
4/// is highlighted.
5pub const DEFAULT_ATTEMPTS_LIMIT: u32 = 3;
6
7/// Play settings
8#[derive(Clone, Serialize, Deserialize, Debug)]
9pub struct PlaySettings {
10    /// Question ordering
11    pub ordering: Ordering,
12
13    /// number of attempts
14    pub n_attempts: Option<u32>,
15
16    /// time limit in minutes
17    pub time_limit: Option<u32>,
18}
19
20impl Default for PlaySettings {
21    fn default() -> Self {
22        Self {
23            n_attempts: Some(DEFAULT_ATTEMPTS_LIMIT),
24            ordering: Default::default(),
25            time_limit: Default::default(),
26        }
27    }
28}
29
30/// Ordering of questions
31#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
32pub enum Ordering {
33    /// Questions should be randomized
34    Randomize,
35
36    /// Questions should be shown in order
37    InOrder,
38}
39
40impl Default for Ordering {
41    fn default() -> Self {
42        Self::InOrder
43    }
44}