branch: master
commit aa259f0edc351f77bf5fe55500978cb42f2d694a
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

    Fix considerations
    
    * org-edna.el (org-edna-handle-consideration): Use floats when computing
      percentage of fulfilled blocks.
---
 org-edna.el | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/org-edna.el b/org-edna.el
index 440c4d9..bb6e548 100644
--- a/org-edna.el
+++ b/org-edna.el
@@ -543,16 +543,14 @@ IDS are all UUIDs as understood by `org-id-find'."
        first-block)
       ((pred integerp)
        ;; A fixed number of them must be fulfilled, so check how many aren't.
-       (let* ((unfulfilled (seq-count #'identity blocks))
-              (fulfilled   (- total-blocks unfulfilled)))
+       (let* ((fulfilled (seq-count #'not blocks)))
          (if (>= fulfilled consideration)
              nil
            first-block)))
       ((pred floatp)
        ;; A certain percentage of them must be fulfilled
-       (let* ((unfulfilled (seq-count #'identity blocks))
-              (fulfilled   (- total-blocks unfulfilled)))
-         (if (>= (/ fulfilled total-blocks) consideration)
+       (let* ((fulfilled (seq-count #'not blocks)))
+         (if (>= (/ (float fulfilled) (float total-blocks)) consideration)
              nil
            first-block))))))
 

Reply via email to