Skip to main content

logicaffeine_web/ui/pages/contact/
claims.rs

1//! The figures the pricing page states, read from where they are set.
2//!
3//! The Learn counts come from the curriculum, so a
4//! release or a new module moves the page with it.
5
6
7use crate::content::ContentEngine;
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub struct LearnFigures {
11    pub modules: usize,
12    pub exercises: usize,
13}
14
15pub fn learn_figures() -> LearnFigures {
16    let modules = ContentEngine::shared().eras().iter().flat_map(|era| &era.modules);
17    LearnFigures {
18        modules: modules.clone().count(),
19        exercises: modules.map(|module| module.exercises.len()).sum(),
20    }
21}
22
23#[cfg(test)]
24#[path = "../../../../../../crates/logicaffeine_tests/unit/logicaffeine_web/ui/pages/contact/claims/tests.rs"]
25mod tests;