Begin implementation of commit.
This commit is contained in:
parent
e98a5dd002
commit
b6d61b5ee9
@ -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
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user