ENH filter quarterly plan nodes with no network status

This commit is contained in:
Nathan Dwarshuis 2022-05-10 17:46:51 -04:00
parent d96f6b7457
commit 96d9f84df0
2 changed files with 29 additions and 28 deletions

View File

@ -2986,7 +2986,7 @@ original function being advised and ARGS are the arguments."
;; (advice-add #'org-agenda-run-series :around #'org-x-agenda-run-series-advice) ;; (advice-add #'org-agenda-run-series :around #'org-x-agenda-run-series-advice)
;; hide the daily tags ;; hide the daily tags
(setq org-agenda-hide-tags-regexp "[DMYQ][0-9]\\{2\\}") (setq org-agenda-hide-tags-regexp "[DMYQ][0-9]\\{1,2\\}")
;; (advice-remove #'org-agenda-run-series #'org-x-agenda-run-series-advice) ;; (advice-remove #'org-agenda-run-series #'org-x-agenda-run-series-advice)
(org-x-dag-set-series-advice t) (org-x-dag-set-series-advice t)

View File

@ -2035,7 +2035,6 @@ If FORCE is non-nil, sync no matter what."
(setq org-x-dag-sync-state)) (setq org-x-dag-sync-state))
nil)) nil))
;; GLOBAL LOOKUP FUNCTIONS ;; GLOBAL LOOKUP FUNCTIONS
;; all functions with `org-x-dag->' or `org-x-dag-id->' depend on the value of ;; all functions with `org-x-dag->' or `org-x-dag-id->' depend on the value of
@ -2930,22 +2929,24 @@ FUTURE-LIMIT in a list."
(let* ((wkp-ids (org-x-dag->current-wkp-ids)) (let* ((wkp-ids (org-x-dag->current-wkp-ids))
(sel-date (org-x-dag->selected-date)) (sel-date (org-x-dag->selected-date))
(q-date (org-x-dag-date-to-quarter-start sel-date))) (q-date (org-x-dag-date-to-quarter-start sel-date)))
(cl-flet
((map-ns
(ns)
(-let (((&plist :planned p :committed c :scheduled-actions s) ns))
(list (-intersection p wkp-ids) c s))))
(org-x-dag-with-ids files (org-x-dag-with-ids files
(pcase (either-from-right (org-x-dag-id->bs it) nil) (pcase (either-from-right (org-x-dag-id->bs it) nil)
(`(:quarterly :active ,dead) (`(:quarterly :active ,dead)
(let* ((tags (org-x-dag-id->tags it)) (let* ((tags (org-x-dag-id->tags it))
(date (org-x-dag-quarter-tags-to-date tags))) (date (org-x-dag-quarter-tags-to-date tags)))
(when (org-x-dag-datetime= q-date date) (when (org-x-dag-datetime= q-date date)
(-when-let (ns (org-x-dag-id->ns it)) (let ((ns (-some-> (org-x-dag-id->ns it)
(-let (((&plist :planned p :committed c :scheduled-actions s) (either-from (-const nil) #'map-ns))))
(either-from-right ns nil)))
;; TODO actually handle deadlines ;; TODO actually handle deadlines
(-> (org-x-dag-format-tag-node tags it) (-> (org-x-dag-format-tag-node tags it)
(org-add-props nil (org-add-props nil
'x-deadline dead 'x-deadline dead
'x-scheduled s 'x-network-status ns)
'x-plannedp (-intersection p wkp-ids)
'x-committedp c)
(list))))))))))) (list)))))))))))
;; TODO not DRY ;; TODO not DRY
@ -4720,10 +4721,10 @@ In the order of display
(org-super-agenda-groups (org-super-agenda-groups
'((:auto-map '((:auto-map
(lambda (line) (lambda (line)
(-let* ((c (get-text-property 1 'x-committedp line)) (-let* ((ns (get-text-property 1 'x-network-status line))
(p (get-text-property 1 'x-plannedp line))
(s (get-text-property 1 'x-scheduled line))
((rank text) ((rank text)
(if (not ns) '(0 "No Network Status")
(-let (((p s c) ns))
(cond (cond
((and s c) ((and s c)
'(5 "Committed | Scheduled")) '(5 "Committed | Scheduled"))
@ -4734,7 +4735,7 @@ In the order of display
((and p (not c)) ((and p (not c))
'(2 "Uncommitted | Planned")) '(2 "Uncommitted | Planned"))
(t (t
'(1 "Unfulfilled | Unplanned"))))) '(1 "Unfulfilled | Unplanned")))))))
(format "%d. %s" rank text)))))))))) (format "%d. %s" rank text))))))))))
(defun org-x-dag-agenda-weekly-plan () (defun org-x-dag-agenda-weekly-plan ()