diff options
author | Akshay <[email protected]> | 2021-02-24 06:27:37 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-02-24 06:27:37 +0000 |
commit | fbcc966a3da8a75842c6b8843a9fd7f1edb0db15 (patch) | |
tree | be2851277e689fec2f1629ca7a03bba1c8931446 /src/habit/count.rs | |
parent | 3169cb6c8056b46a6f08533014366b8c441971f8 (diff) |
add GoalKinds
- this allows for changing habit goals easily
- easier to add new habits to dijo in newer versions
Diffstat (limited to 'src/habit/count.rs')
-rw-r--r-- | src/habit/count.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/habit/count.rs b/src/habit/count.rs index 09fd399..75b51cc 100644 --- a/src/habit/count.rs +++ b/src/habit/count.rs | |||
@@ -4,6 +4,7 @@ use std::default::Default; | |||
4 | use chrono::NaiveDate; | 4 | use chrono::NaiveDate; |
5 | use serde::{Deserialize, Serialize}; | 5 | use serde::{Deserialize, Serialize}; |
6 | 6 | ||
7 | use crate::command::GoalKind; | ||
7 | use crate::habit::prelude::default_auto; | 8 | use crate::habit::prelude::default_auto; |
8 | use crate::habit::traits::Habit; | 9 | use crate::habit::traits::Habit; |
9 | use crate::habit::{InnerData, TrackEvent}; | 10 | use crate::habit::{InnerData, TrackEvent}; |
@@ -42,6 +43,9 @@ impl Habit for Count { | |||
42 | fn set_name(&mut self, n: impl AsRef<str>) { | 43 | fn set_name(&mut self, n: impl AsRef<str>) { |
43 | self.name = n.as_ref().to_owned(); | 44 | self.name = n.as_ref().to_owned(); |
44 | } | 45 | } |
46 | fn kind(&self) -> GoalKind { | ||
47 | GoalKind::Count(self.goal) | ||
48 | } | ||
45 | fn set_goal(&mut self, g: Self::HabitType) { | 49 | fn set_goal(&mut self, g: Self::HabitType) { |
46 | self.goal = g; | 50 | self.goal = g; |
47 | } | 51 | } |