2026-07-11 18:23:01 +07:00
|
|
|
use crate::app::state::rest::AppStateRest;
|
|
|
|
|
|
|
|
|
|
pub const EFFORT_LEVELS: &[&str] = &["low", "medium", "high", "xhigh", "max"];
|
|
|
|
|
|
2026-07-11 21:25:30 +07:00
|
|
|
pub fn current_effort(state: &AppStateRest) -> usize {
|
|
|
|
|
state.misc.effort_level.min(EFFORT_LEVELS.len() - 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn current_effort_str(state: &AppStateRest) -> &'static str {
|
|
|
|
|
let idx = current_effort(state);
|
|
|
|
|
EFFORT_LEVELS[idx]
|
2026-07-11 18:23:01 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn cycle_effort(state: &mut AppStateRest) {
|
|
|
|
|
let current = current_effort(state);
|
2026-07-11 21:25:30 +07:00
|
|
|
state.misc.effort_level = (current + 1) % EFFORT_LEVELS.len();
|
|
|
|
|
state.dirty = true;
|
|
|
|
|
}
|