From c3d31ec2133021fbbeb4c5cb7eaf245459ac717c Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 7 Aug 2024 12:33:27 +0300 Subject: get-note-lethe: Prioritize tags over decks. * get-note-tag-lethe: Returns either nil or max lethe value. * get-note-lethe: Returns deck value only if tags value is nil. --- gnosis.el | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index cb72f01..e9d8604 100644 --- a/gnosis.el +++ b/gnosis.el @@ -2127,23 +2127,31 @@ CUSTOM-DECK: Custom deck to be used instead." note-anagnosis)) (defun gnosis-get-note-deck-lethe (id &optional custom-deck custom-values) - "Return lethe deck value for note ID." + "Return lethe deck value for note ID. + +CUSTOM-VALUES: Custom values to be used instead. +CUSTOM-DECK: Custom deck to be used instead." (let ((deck (or (gnosis-get-note-deck-name id) custom-deck))) (or (gnosis-get-custom-deck-value deck :lethe custom-values) gnosis-algorithm-lethe-value))) (defun gnosis-get-note-tag-lethe (id &optional custom-tags custom-values) - "Return note ID tag lethe values." + "Return note ID tag lethe values. + +CUSTOM-VALUES: Custom values to be used instead. +CUSTOM-TAGS: Custom tags to be used instead." (let ((lethe-values (gnosis-get-custom-tag-values id :lethe custom-tags custom-values))) - (if lethe-values - (apply #'min lethe-values) - gnosis-algorithm-lethe-value))) + (and lethe-values (apply #'min lethe-values)))) (defun gnosis-get-note-lethe (id &optional custom-deck custom-tags custom-values) - "Return note ID lethe value." + "Return note ID lethe value. + +CUSTOM-VALUES: Custom values to be used instead. +CUSTOM-TAGS: Custom tags to be used instead. +CUSTOM-DECK: Custom deck to be used instead." (let* ((deck-lethe (gnosis-get-note-deck-lethe id custom-deck custom-values)) (tag-lethe (gnosis-get-note-tag-lethe id custom-tags custom-values)) - (note-lethe (min deck-lethe tag-lethe))) + (note-lethe (or tag-lethe deck-lethe))) note-lethe)) (defun gnosis-get-date-total-notes (&optional date) -- cgit v1.2.3