ADD logic to tell if iterators need to be refilled (oops)

This commit is contained in:
Nathan Dwarshuis 2022-05-27 21:36:04 -04:00
parent 7a3532ed90
commit 582e938e50
1 changed files with 36 additions and 12 deletions

View File

@ -62,6 +62,12 @@
(defun org-x-dag-time-is-archivable-p (epochtime) (defun org-x-dag-time-is-archivable-p (epochtime)
(< (* 60 60 24 org-x-archive-delay) (- (float-time) epochtime))) (< (* 60 60 24 org-x-archive-delay) (- (float-time) epochtime)))
;; org ml wrappers
(defun org-x-dag-timestamp-to-epoch (ts)
(->> (org-ml-timestamp-get-start-time ts)
(org-ml-time-to-unixtime)))
;; calendar interface ;; calendar interface
(defun org-x-dag-gregorian-to-date (greg) (defun org-x-dag-gregorian-to-date (greg)
@ -3023,16 +3029,31 @@ FUTURE-LIMIT in a list."
(list)))))))))) (list))))))))))
(defun org-x-dag-itemize-iterators (files) (defun org-x-dag-itemize-iterators (files)
(org-x-dag-with-unmasked-action-ids files (cl-flet
(pcase it-local ((get-status
(`(:sp-iter . ,status-data) (data)
(let ((status (car status-data))) (pcase data
(when (memq status '(:iter-empty :iter-active)) (`(:iter-empty) :empty)
(let ((tags (org-x-dag-id->tags it))) (`(:iter-active ,data)
(-> (org-x-dag-format-tag-node tags it) (-let* (((&plist :dead d :sched s) data)
(org-add-props nil (d* (-some->> d (org-x-dag-timestamp-to-epoch)))
'x-status status) (s* (-some->> s (org-x-dag-timestamp-to-epoch))))
(list))))))))) (-if-let (epoch (if (and d* s*) (min d* s*) (or s* d*)))
(if (< (+ (float-time) org-x-iterator-active-future-offset)
epoch)
:active
:refill)
:unknown)))
(`(:iter-complete ,_) :complete))))
(org-x-dag-with-unmasked-action-ids files
(pcase it-local
(`(:sp-iter . ,status-data)
(let ((status (get-status status-data))
(tags (org-x-dag-id->tags it)))
(-> (org-x-dag-format-tag-node tags it)
(org-add-props nil
'x-status status)
(list))))))))
(defun org-x-dag-itemize-incubated (files) (defun org-x-dag-itemize-incubated (files)
(org-x-dag-with-unmasked-action-ids files (org-x-dag-with-unmasked-action-ids files
@ -5041,8 +5062,11 @@ review phase)"
(lambda (line) (lambda (line)
(let ((s (get-text-property 1 'x-status line))) (let ((s (get-text-property 1 'x-status line)))
(pcase s (pcase s
(:iter-empty "1. Empty") (:unknown "0. Unknown")
(:iter-active "2. Active"))))))))))) (:complete "1. Refill")
(:empty "2. Empty")
(:refill "3. Refill")
(:active "4. Active")))))))))))
(defun org-x-dag-agenda-errors () (defun org-x-dag-agenda-errors ()
"Show the critical errors agenda view." "Show the critical errors agenda view."