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