From 86f495e11714905a72fad6b25f1f8b9ae7370d50 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 22 Sep 2014 21:34:35 +0200 Subject: Update pivot.el --- emacs/.emacs.d/site-lisp/pivot.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/site-lisp/pivot.el b/emacs/.emacs.d/site-lisp/pivot.el index b184a88..336021f4 100644 --- a/emacs/.emacs.d/site-lisp/pivot.el +++ b/emacs/.emacs.d/site-lisp/pivot.el @@ -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) -- cgit v1.2.3-54-g00ecf