HabitModel get activeLabel of Entry

This commit is contained in:
2022-02-03 22:04:00 -07:00
parent b614601b33
commit e303c66655
2 changed files with 9 additions and 1 deletions

View File

@@ -80,3 +80,9 @@
(+= content (.join (map todoEntries stringify) "\n") "\n")
(File.saveContent textFile
content))
// With rotating entries, the active one is the first one with the lowest score:
(function :EntryLabel activeLabel [:Entry e]
(let [lowScore (apply min (for label e.labels label.points))]
(doFor label e.labels (when (= lowScore label.points) (return label)))
(throw "no active?!")))

View File

@@ -2,4 +2,6 @@
(method &override :Void update [:Float elapsed] (super.update elapsed))
(prop &mut :HabitModel model null)
(method setModel [m] (set model ~m))
(method setModel [m]
(set model m)
(doFor e model.bonusEntries ~(HabitModel.activeLabel e)))