diff --git a/src/habit.rs b/src/habit.rs index 6663044..54507c4 100644 --- a/src/habit.rs +++ b/src/habit.rs @@ -29,6 +29,8 @@ pub struct Habit priority:char, // Day 0 is Monday. Use number_days_from_monday() to determine index. days_active:[bool;7], + done:bool, + streak:i32, } impl Habit @@ -46,6 +48,8 @@ impl Habit bad, priority, days_active, + done: false, + streak: 0, } } @@ -85,9 +89,13 @@ impl Habit pub fn get_name(&self) -> &String { &self.name } pub fn get_bad(&self) -> bool { self.bad } pub fn get_priority(&self) -> char { self.priority } + pub fn get_done(&self) -> bool { self.done } + pub fn get_streak(&self) -> i32 { self.streak } pub fn set_name(&mut self, name:String) { self.name = name; } pub fn set_bad(&mut self, bad:bool) { self.bad = bad; } pub fn set_priority(&mut self, priority:char) { self.priority = priority; } pub fn set_days(&mut self, days:[bool;7]) { self.days_active = days; } + pub fn set_done(&mut self, done:bool) { self.done = done; } + // TODO: whether set_streak or inc/dec/reset_streak } diff --git a/src/habitmgr.rs b/src/habitmgr.rs index 5b91f7b..a3809ba 100644 --- a/src/habitmgr.rs +++ b/src/habitmgr.rs @@ -192,16 +192,18 @@ impl HabitMgr } else { - println!(" {0: <3} | {1: <5} | {2: <8} | {3}", - "id", "bad", "priority", "name"); + println!(" {0: <3} | {1: <5} | {2: <8} | {3: <5} | {4: <6} | {5}", + "id", "bad", "priority", "done", "streak", "name"); for (i, habit) in self.habits.iter().enumerate() { if all || habit.active_today() { - println!(" {0: <3} | {1: <5} | {2: <8} | {3}", + println!(" {0: <3} | {1: <5} | {2: <8} | {3: <5} | {4: <6} | {5}", i, habit.get_bad(), habit.get_priority(), + habit.get_done(), + habit.get_streak(), habit.get_name()); } }