Skip to content

Commit

Permalink
made a check for any sesh existence
Browse files Browse the repository at this point in the history
  • Loading branch information
angelplusultra committed Oct 3, 2024
1 parent e01feba commit b5049db
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ impl App {
loop {
// check if an active session exists
let has_active_session = self.data.get(&self.today).unwrap().active_session.is_some();
let has_no_sessions = self.data.values().all(|v| v.sessions.is_empty());

// Filter selection options
let opts = vec![
Expand All @@ -76,6 +77,7 @@ impl App {
1 if !has_active_session => false,
2 if !has_active_session => false, // Only show if an active session exists
3 if has_active_session => false,
4 | 5 if has_no_sessions => false,
_ => true,
})
.collect::<Vec<(i32, &str)>>();
Expand Down

0 comments on commit b5049db

Please sign in to comment.