fix: Repair push-task-list
Make all the commented-out stuff in push-task-list work properly
This commit is contained in:
		
							parent
							
								
									750b547327
								
							
						
					
					
						commit
						dfc2335edb
					
				
					 1 changed files with 25 additions and 25 deletions
				
			
		| 
						 | 
					@ -692,39 +692,39 @@ children of that headline into tasks in the task list of the story."
 | 
				
			||||||
   :data (json-encode `((description . ,title)))))
 | 
					   :data (json-encode `((description . ,title)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun org-clubhouse-push-task-list (&optional parent-clubhouse-id child-elts)
 | 
					(defun org-clubhouse-push-task-list (&optional parent-clubhouse-id child-elts)
 | 
				
			||||||
  "Writes each child element of the current clubhouse element as a task list
 | 
					  "Writes each child of the element at point as a task list item.
 | 
				
			||||||
item of the associated clubhouse ID.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
when called as (org-clubhouse-push-task-list PARENT-CLUBHOUSE-ID CHILD-ELTS),
 | 
					When called as (org-clubhouse-push-task-list PARENT-CLUBHOUSE-ID CHILD-ELTS),
 | 
				
			||||||
allows manually passing a clubhouse ID and list of org-element plists to write"
 | 
					allows manually passing a clubhouse ID and list of org-element plists to write"
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (let* ((elt (org-element-and-children-at-point))
 | 
					  (let* ((elt (org-element-and-children-at-point))
 | 
				
			||||||
         (parent-clubhouse-id (or parent-clubhouse-id
 | 
					         (parent-clubhouse-id (or parent-clubhouse-id
 | 
				
			||||||
                                  (org-element-extract-clubhouse-id elt)))
 | 
					                                  (org-element-extract-clubhouse-id elt)))
 | 
				
			||||||
         (child-elts (or child-elts (plist-get elt :children)))
 | 
					         (child-elts (or child-elts (plist-get elt :children)))
 | 
				
			||||||
         ;; (story (org-clubhouse-get-story parent-clubhouse-id))
 | 
					         (story (org-clubhouse-get-story parent-clubhouse-id))
 | 
				
			||||||
         ;; (existing-tasks (alist-get 'tasks story))
 | 
					         (existing-tasks (alist-get 'tasks story))
 | 
				
			||||||
         ;; (task-exists
 | 
					         (task-exists
 | 
				
			||||||
         ;;  (lambda (task-name)
 | 
					          (lambda (task-name)
 | 
				
			||||||
         ;;    (some (lambda (task)
 | 
					            (cl-some (lambda (task)
 | 
				
			||||||
         ;;            (string-equal task-name (alist-get 'description task)))
 | 
					                    (string-equal task-name (alist-get 'description task)))
 | 
				
			||||||
         ;;          (existing-tasks))))
 | 
					                  existing-tasks)))
 | 
				
			||||||
         )
 | 
					         (elts-with-starts
 | 
				
			||||||
    (dolist (child-elt child-elts)
 | 
					          (-map (lambda (e) (cons (set-marker (make-marker)
 | 
				
			||||||
      (let ((task-name (plist-get child-elt :title)))
 | 
					                                         (plist-get e :begin))
 | 
				
			||||||
        ;; (unless (task-exists task-name)
 | 
					                             e))
 | 
				
			||||||
 | 
					                child-elts)))
 | 
				
			||||||
 | 
					    (dolist (child-elt-and-start elts-with-starts)
 | 
				
			||||||
 | 
					      (let* ((start (car child-elt-and-start))
 | 
				
			||||||
 | 
					             (child-elt (cdr child-elt-and-start))
 | 
				
			||||||
 | 
					             (task-name (plist-get child-elt :title)))
 | 
				
			||||||
 | 
					        (unless (funcall task-exists task-name)
 | 
				
			||||||
          (let ((task (org-clubhouse-create-task
 | 
					          (let ((task (org-clubhouse-create-task
 | 
				
			||||||
                       task-name
 | 
					                       task-name
 | 
				
			||||||
                       :story-id parent-clubhouse-id)))
 | 
					                       :story-id parent-clubhouse-id)))
 | 
				
			||||||
          ;; TODO this doesn't currently work, since the act of populating the
 | 
					            (org-clubhouse-populate-created-task child-elt task start)))))))
 | 
				
			||||||
          ;; previous task bumps up the char start of the next task
 | 
					 | 
				
			||||||
          ;; (org-clubhouse-populate-created-task child-elt task)
 | 
					 | 
				
			||||||
          )
 | 
					 | 
				
			||||||
        ;; )
 | 
					 | 
				
			||||||
        ))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun org-clubhouse-populate-created-task (elt task)
 | 
					(defun org-clubhouse-populate-created-task (elt task &optional begin)
 | 
				
			||||||
  (let ((elt-start (plist-get elt :begin))
 | 
					  (let ((elt-start (or begin (plist-get elt :begin)))
 | 
				
			||||||
        (task-id   (alist-get 'id task))
 | 
					        (task-id   (alist-get 'id task))
 | 
				
			||||||
        (story-id  (alist-get 'story_id task)))
 | 
					        (story-id  (alist-get 'story_id task)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue