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)))
(org-x-dag-with-ids files (cl-flet
(pcase (either-from-right (org-x-dag-id->bs it) nil) ((map-ns
(`(:quarterly :active ,dead) (ns)
(let* ((tags (org-x-dag-id->tags it)) (-let (((&plist :planned p :committed c :scheduled-actions s) ns))
(date (org-x-dag-quarter-tags-to-date tags))) (list (-intersection p wkp-ids) c s))))
(when (org-x-dag-datetime= q-date date) (org-x-dag-with-ids files
(-when-let (ns (org-x-dag-id->ns it)) (pcase (either-from-right (org-x-dag-id->bs it) nil)
(-let (((&plist :planned p :committed c :scheduled-actions s) (`(:quarterly :active ,dead)
(either-from-right ns nil))) (let* ((tags (org-x-dag-id->tags it))
(date (org-x-dag-quarter-tags-to-date tags)))
(when (org-x-dag-datetime= q-date date)
(let ((ns (-some-> (org-x-dag-id->ns it)
(either-from (-const nil) #'map-ns))))
;; 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,21 +4721,21 @@ 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)
(cond (if (not ns) '(0 "No Network Status")
((and s c) (-let (((p s c) ns))
'(5 "Committed | Scheduled")) (cond
((and p c) ((and s c)
'(4 "Committed | Planned")) '(5 "Committed | Scheduled"))
((and (not p) c) ((and p c)
'(3 "Committed | Unplanned")) '(4 "Committed | Planned"))
((and p (not c)) ((and (not p) c)
'(2 "Uncommitted | Planned")) '(3 "Committed | Unplanned"))
(t ((and p (not c))
'(1 "Unfulfilled | Unplanned"))))) '(2 "Uncommitted | Planned"))
(t
'(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 ()