feat: Use workflow state for todo-keyword
Base the todo-keyword of a created story on its workflow-state in clubhouse, rather than just hardcoding it to TODO Fixes #11
This commit is contained in:
parent
5682f4bb57
commit
d338b4d304
1 changed files with 18 additions and 2 deletions
|
@ -120,6 +120,10 @@ not be prompted")
|
|||
(-find (lambda (pair) (equal key (car pair))))
|
||||
(cdr)))
|
||||
|
||||
(defun invert-alist (alist)
|
||||
"Invert the keys and values of ALIST."
|
||||
(-map (lambda (cell) (cons (cdr cell) (car cell))) alist))
|
||||
|
||||
(comment
|
||||
|
||||
(alist->plist
|
||||
|
@ -427,6 +431,17 @@ not be prompted")
|
|||
(id . :id)
|
||||
(status . :status)))))))
|
||||
|
||||
(defun org-clubhouse-workflow-state-id-to-todo-keyword (workflow-state-id)
|
||||
"Convert the named clubhouse WORKFLOW-STATE-ID to an org todo keyword."
|
||||
(let* ((state-name (alist-get-equal
|
||||
workflow-state-id
|
||||
(invert-alist (org-clubhouse-workflow-states))))
|
||||
(inv-state-name-alist
|
||||
(-map (lambda (cell) (cons (cdr cell) (car cell)))
|
||||
org-clubhouse-state-alist)))
|
||||
(or (alist-get-equal state-name inv-state-name-alist)
|
||||
(s-upcase state-name))))
|
||||
|
||||
;;;
|
||||
;;; Prompting
|
||||
;;;
|
||||
|
@ -804,7 +819,7 @@ resulting stories at headline level LEVEL."
|
|||
(insert
|
||||
(mapconcat (lambda (story)
|
||||
(format
|
||||
"%s TODO %s
|
||||
"%s %s %s
|
||||
:PROPERTIES:
|
||||
:clubhouse-id: %s
|
||||
:END:
|
||||
|
@ -813,6 +828,8 @@ resulting stories at headline level LEVEL."
|
|||
:END:
|
||||
"
|
||||
(make-string level ?*)
|
||||
(org-clubhouse-workflow-state-id-to-todo-keyword
|
||||
(alist-get 'workflow_state_id story))
|
||||
(alist-get 'name story)
|
||||
(let ((story-id (alist-get 'id story)))
|
||||
(org-make-link-string
|
||||
|
@ -832,6 +849,5 @@ linked ticket in Clubhouse."
|
|||
nil
|
||||
t))
|
||||
|
||||
|
||||
(provide 'org-clubhouse)
|
||||
;;; org-clubhouse.el ends here
|
||||
|
|
Loading…
Reference in a new issue