Update pivot.el

This commit is contained in:
Tom Willemse 2014-09-22 21:34:35 +02:00
parent 3dad71a9b7
commit 86f495e117

View file

@ -24,6 +24,7 @@
;;; Code:
(require 'json)
(require 'url)
(defgroup pivotel nil
@ -98,15 +99,19 @@ Does not need a final `/'.")
"Get all stories for the current user."
(let ((project-ids (mapcar (lambda (itm) (cdr (assoc 'id itm)))
(pivotel-get-projects))))
(mapcar #'pivotel-get-stories project-ids)))
(apply #'append
(append (mapcar #'pivotel-get-stories project-ids) '(nil)))))
(defun pivotel--my-story-p (story)
"Check whether or not STORY belongs to the current user."
(memql (pivotel-get-me-id)
(append (cdr (assoc 'owner_ids story)) '(nil))))
(defun pivotel-get-my-owned-stories ()
"Get the stories for which the user is an owner."
(let ((stories (pivotel-get-all-stories))
(id (pivotel-get-me-id)))
(let ((stories (pivotel-get-all-stories)))
(delq nil
(mapcar (lambda (itm)
(when (= (cdr (assoc 'owned_by_id itm)) id) itm))
(mapcar (lambda (itm) (when (pivotel--my-story-p itm) itm))
stories))))
(provide 'pivot)