HabitModel.totalPoints()

This commit is contained in:
2022-02-04 15:47:01 -07:00
parent 1fa8171025
commit 174e0a30fd
2 changed files with 4 additions and 0 deletions

View File

@@ -67,6 +67,9 @@
points (count (l.split "") ->c (= c "|"))))))) points (count (l.split "") ->c (= c "|")))))))
(otherwise (break)))))) (otherwise (break))))))
(method :Int totalPoints []
(apply + (for l (flatten (for e (the Array<Entry> (concat dailyEntries bonusEntries todoEntries)) e.labels)) l.points)))
(function :String stringify [:Entry e] (function :String stringify [:Entry e]
"$(ifLet [(when !(= days.length 7) (Daily days)) e.type] "$(ifLet [(when !(= days.length 7) (Daily days)) e.type]
(+ (.join (for day days (+ (.join (for day days

View File

@@ -11,6 +11,7 @@
(prop &mut :HabitModel model null) (prop &mut :HabitModel model null)
(method setModel [m] (method setModel [m]
(set model m) (set model m)
~(m.totalPoints)
(set shortcutHandler (new KeyShortcutHandler)) (set shortcutHandler (new KeyShortcutHandler))
(when entryTexts (remove entryTexts)) (when entryTexts (remove entryTexts))