From cdd81a8546b1290206f03cb6784a0670d5ef537c Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Thu, 1 Oct 2015 16:51:32 -0400 Subject: * rt-report.el: Add new file. --- rt-report.el | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 rt-report.el diff --git a/rt-report.el b/rt-report.el new file mode 100644 index 0000000..94e7118 --- /dev/null +++ b/rt-report.el @@ -0,0 +1,39 @@ +;;; rt-report.el --- Free from RT + +;; Copyright (C) 2015 Yoni Rabkin +;; +;; Authors: Yoni Rabkin +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2 of the +;; License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public +;; License along with this program; if not, write to the Free +;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +;; MA 02111-1307, USA. + +;;; History: +;; +;; I wrote rt-report.py sometime in 2013 because people asked for some +;; information as to how many tickets were being resolved, and by +;; whom. When in came time up update rt-report.py I came to my senses +;; and decided to re-write it in Emacs Lisp as a part of +;; rt-liberation. + + +;;; Code: + +(require 'rt-liberation-rest) + + + +(provide 'rt-report) + +;;; rt-report.el ends here. -- cgit v1.2.3 From 277378d349e96c03289c038b47494c4f659b3b3b Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Sat, 10 Oct 2015 21:36:14 -0400 Subject: Rename to fit file naming convention. --- rt-liberation-report.el | 39 +++++++++++++++++++++++++++++++++++++++ rt-report.el | 39 --------------------------------------- 2 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 rt-liberation-report.el delete mode 100644 rt-report.el diff --git a/rt-liberation-report.el b/rt-liberation-report.el new file mode 100644 index 0000000..94e7118 --- /dev/null +++ b/rt-liberation-report.el @@ -0,0 +1,39 @@ +;;; rt-report.el --- Free from RT + +;; Copyright (C) 2015 Yoni Rabkin +;; +;; Authors: Yoni Rabkin +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2 of the +;; License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public +;; License along with this program; if not, write to the Free +;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +;; MA 02111-1307, USA. + +;;; History: +;; +;; I wrote rt-report.py sometime in 2013 because people asked for some +;; information as to how many tickets were being resolved, and by +;; whom. When in came time up update rt-report.py I came to my senses +;; and decided to re-write it in Emacs Lisp as a part of +;; rt-liberation. + + +;;; Code: + +(require 'rt-liberation-rest) + + + +(provide 'rt-report) + +;;; rt-report.el ends here. diff --git a/rt-report.el b/rt-report.el deleted file mode 100644 index 94e7118..0000000 --- a/rt-report.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; rt-report.el --- Free from RT - -;; Copyright (C) 2015 Yoni Rabkin -;; -;; Authors: Yoni Rabkin -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 2 of the -;; License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public -;; License along with this program; if not, write to the Free -;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. - -;;; History: -;; -;; I wrote rt-report.py sometime in 2013 because people asked for some -;; information as to how many tickets were being resolved, and by -;; whom. When in came time up update rt-report.py I came to my senses -;; and decided to re-write it in Emacs Lisp as a part of -;; rt-liberation. - - -;;; Code: - -(require 'rt-liberation-rest) - - - -(provide 'rt-report) - -;;; rt-report.el ends here. -- cgit v1.2.3 From 6f53df4e82f4c0aa76920abdaff4f306ad55a433 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Sat, 10 Oct 2015 22:23:48 -0400 Subject: Add research notes. --- rt-liberation-report.el | 66 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index 94e7118..0d693a0 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -1,4 +1,4 @@ -;;; rt-report.el --- Free from RT +;;; rt-liberation-report.el --- Free from RT ;; Copyright (C) 2015 Yoni Rabkin ;; @@ -32,8 +32,70 @@ (require 'rt-liberation-rest) +;; This query works for a single day _BUT_ only if `resolved' is added +;; as a `rt-liber-attrib-p'. The `nil' is the result when there are no +;; tickets to return and the list is what comes back when tickets are +;; found. +;; +;; (rt-liber-rest-run-show-base-query +;; (rt-liber-rest-run-ls-query +;; (rt-liber-compile-query +;; (and (queue "licensing") +;; (resolved "2015-10-09") +;; (status "resolved"))))) +;; +;; However, note that the following inequalities work too and would be +;; the right way to do the query: +;; +;; (rt-liber-rest-run-ls-query "Queue = 'licensing' AND Resolved < +;; '2015-10-02' AND Resolved > '2015-09-28' AND Status = 'resolved'") +;; +;; NOTE!!! rt-liberation already supports "temporal" predicates, but I +;; need to add `resolved' ("Resolved") as one of them and check that +;; it works. +;; +;; nil +;; +;; ((("TimeLeft" . "0") +;; ("TimeWorked" . "0") +;; ("TimeEstimated" . "0") +;; ("Told" . "Thu Oct 08 00:53:59 2015") +;; ("Resolved" . "Thu Oct 08 00:53:59 2015") +;; ("Due" . "Not set") +;; ("Started" . "Wed Oct 07 06:52:03 2015") +;; ("Starts" . "Not set") +;; ("Created" . "Wed Oct 07 06:39:22 2015") +;; ("Requestors" . "ian.macintosh@gtxweb.uk") +;; ("FinalPriority" . "0") +;; ("InitialPriority" . "0") +;; ("Priority" . "0") +;; ("Status" . "resolved") +;; ("Subject" . "Badly worded and misleading paragraph") +;; ("Creator" . "ian.macintosh@gtxweb.uk") +;; ("Owner" . "jgay@fsf.org") +;; ("Queue" . "licensing") +;; ("id" . "ticket/1052419")) +;; (("TimeLeft" . "0") +;; ("TimeWorked" . "0") +;; ("TimeEstimated" . "0") +;; ("Told" . "Thu Oct 08 07:54:47 2015") +;; ("Resolved" . "Thu Oct 08 07:54:47 2015") +;; ("Due" . "Not set") +;; ("Started" . "Wed Oct 07 12:03:20 2015") +;; ("Starts" . "Not set") +;; ("Created" . "Mon Sep 21 13:33:24 2015") +;; ("Requestors" . "juan.balderas.0@gmail.com") +;; ("FinalPriority" . "0") +;; ("InitialPriority" . "0") +;; ("Priority" . "0") +;; ("Status" . "resolved") +;; ("Subject" . "Softare donation to FSF") +;; ("Creator" . "juan.balderas.0@gmail.com") +;; ("Owner" . "donald") +;; ("Queue" . "licensing") +;; ("id" . "ticket/1048183"))) (provide 'rt-report) -;;; rt-report.el ends here. +;;; rt-liberation-report.el ends here. -- cgit v1.2.3 From cca328cbacb57113c8e5db95a0471c2b392f99ee Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Sun, 11 Oct 2015 15:02:27 -0400 Subject: * rt-liberation.el: Add Resolved time predicate. --- rt-liberation.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rt-liberation.el b/rt-liberation.el index b9b013f..b32efb4 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -52,6 +52,9 @@ (defvar rt-liber-created-string "Created" "String representation of \"created\" query tag.") +(defvar rt-liber-resolved-string "Resolved" + "String representation of \"resolved\" query tag.") + (defvar rt-liber-base-url "" "Base url for ticket display.") @@ -244,7 +247,7 @@ This variable is made buffer local for the ticket history") email-address))) (defun rt-liber-time-p (sym) "Return t if SYM is a temporal attribute, otherwise nil." - (member sym '(created lastupdated))) + (member sym '(created lastupdated resolved))) (defun rt-liber-negation-p (sym) (member sym '(not))) @@ -291,7 +294,8 @@ AFTER date after predicate." ;; time ((rt-liber-time-p query) `,(cond ((equal query 'created) rt-liber-created-string) - ((equal query 'lastupdated) rt-liber-lastupdated-string))) + ((equal query 'lastupdated) rt-liber-lastupdated-string) + ((equal query 'resolved) rt-liber-resolved-string))) ((and (listp query) (rt-liber-time-p (car query))) `(rt-liber-make-interval -- cgit v1.2.3 From d4cfeedfa831549a2067f8d29c77b162e86692bf Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Sun, 11 Oct 2015 15:02:41 -0400 Subject: * rt-liberation-report.el: Evolve notes. --- rt-liberation-report.el | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index 0d693a0..81fd50c 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -32,30 +32,22 @@ (require 'rt-liberation-rest) -;; This query works for a single day _BUT_ only if `resolved' is added -;; as a `rt-liber-attrib-p'. The `nil' is the result when there are no -;; tickets to return and the list is what comes back when tickets are -;; found. -;; -;; (rt-liber-rest-run-show-base-query -;; (rt-liber-rest-run-ls-query -;; (rt-liber-compile-query -;; (and (queue "licensing") -;; (resolved "2015-10-09") -;; (status "resolved"))))) -;; -;; However, note that the following inequalities work too and would be -;; the right way to do the query: -;; -;; (rt-liber-rest-run-ls-query "Queue = 'licensing' AND Resolved < -;; '2015-10-02' AND Resolved > '2015-09-28' AND Status = 'resolved'") -;; -;; NOTE!!! rt-liberation already supports "temporal" predicates, but I -;; need to add `resolved' ("Resolved") as one of them and check that -;; it works. -;; -;; nil -;; +(defun rt-liberation-report-resolved-interval (rt-queue start-date end-date) + "Return tickets resolved between START-DATE and END-DATE. + +The tickets must have their current status be Resolved in order +to be returned by this function. If no tickets match the query, +return `nil'." + (rt-liber-rest-run-show-base-query + (rt-liber-rest-run-ls-query + (rt-liber-compile-query + (and (queue rt-queue) + (resolved start-date end-date) + (status "resolved")))))) + +;; (rt-liberation-report-resolved-interval "licensing" "2015-09-18" "2015-09-17") + + ;; ((("TimeLeft" . "0") ;; ("TimeWorked" . "0") ;; ("TimeEstimated" . "0") -- cgit v1.2.3 From 9ce5b010422e4e577be07748ff7e38f656412a25 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Mon, 12 Oct 2015 14:01:15 -0400 Subject: * rt-liberation.el: Clear up old CLI note. --- rt-liberation.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rt-liberation.el b/rt-liberation.el index b32efb4..03ce583 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -435,12 +435,6 @@ AFTER date after predicate." ;;; Ticket retriever ;;; -------------------------------------------------------- -;; Implementation note: Working with 3.8.1 or 3.8.2 of the RT CLI -;; makes a huge difference here. 3.8.1 returns a kind of listing of -;; the history ID objects which requires further processing. 3.8.2 on -;; the other hand returns the contents of all the ticket history -;; objects in one fell swoop. - (defun rt-liber-create-ticket-history-string (ticket-id) "Create a query for TICKET-ID to retrieve all history objects." (concat "ticket/" ticket-id "/history/id")) -- cgit v1.2.3 From cd29eacb888877bec75157002858583c8b1dd3a5 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Mon, 12 Oct 2015 14:01:44 -0400 Subject: Add collation. --- rt-liberation-report.el | 97 ++++++++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index 81fd50c..2e6a545 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -32,12 +32,20 @@ (require 'rt-liberation-rest) -(defun rt-liberation-report-resolved-interval (rt-queue start-date end-date) +(defvar rt-liber-report-csv-header + '("date" "tickets resolved") + "Headers for comma separated value output.") + +(defun rt-liber-report-get-interval (rt-queue start-date end-date) "Return tickets resolved between START-DATE and END-DATE. The tickets must have their current status be Resolved in order to be returned by this function. If no tickets match the query, return `nil'." + (when (or (not (stringp rt-queue)) + (not (stringp start-date)) + (not (stringp end-date))) + (error "bad argument/s")) (rt-liber-rest-run-show-base-query (rt-liber-rest-run-ls-query (rt-liber-compile-query @@ -45,47 +53,52 @@ return `nil'." (resolved start-date end-date) (status "resolved")))))) -;; (rt-liberation-report-resolved-interval "licensing" "2015-09-18" "2015-09-17") - - -;; ((("TimeLeft" . "0") -;; ("TimeWorked" . "0") -;; ("TimeEstimated" . "0") -;; ("Told" . "Thu Oct 08 00:53:59 2015") -;; ("Resolved" . "Thu Oct 08 00:53:59 2015") -;; ("Due" . "Not set") -;; ("Started" . "Wed Oct 07 06:52:03 2015") -;; ("Starts" . "Not set") -;; ("Created" . "Wed Oct 07 06:39:22 2015") -;; ("Requestors" . "ian.macintosh@gtxweb.uk") -;; ("FinalPriority" . "0") -;; ("InitialPriority" . "0") -;; ("Priority" . "0") -;; ("Status" . "resolved") -;; ("Subject" . "Badly worded and misleading paragraph") -;; ("Creator" . "ian.macintosh@gtxweb.uk") -;; ("Owner" . "jgay@fsf.org") -;; ("Queue" . "licensing") -;; ("id" . "ticket/1052419")) -;; (("TimeLeft" . "0") -;; ("TimeWorked" . "0") -;; ("TimeEstimated" . "0") -;; ("Told" . "Thu Oct 08 07:54:47 2015") -;; ("Resolved" . "Thu Oct 08 07:54:47 2015") -;; ("Due" . "Not set") -;; ("Started" . "Wed Oct 07 12:03:20 2015") -;; ("Starts" . "Not set") -;; ("Created" . "Mon Sep 21 13:33:24 2015") -;; ("Requestors" . "juan.balderas.0@gmail.com") -;; ("FinalPriority" . "0") -;; ("InitialPriority" . "0") -;; ("Priority" . "0") -;; ("Status" . "resolved") -;; ("Subject" . "Softare donation to FSF") -;; ("Creator" . "juan.balderas.0@gmail.com") -;; ("Owner" . "donald") -;; ("Queue" . "licensing") -;; ("id" . "ticket/1048183"))) +(defun rt-liber-report-scan-ticket (ticket-alist) + (let ((date-resolved (cdr (assoc "Resolved" ticket-alist))) + (owner (cdr (assoc "Owner" ticket-alist)))) + `(,(format-time-string "%d-%m-%Y" (date-to-time date-resolved)) + . ,owner))) + +(defun rt-liber-report-scan-interval (interval) + "Convert the list of tickets into an ordered format." + (when (not interval) + (error "no tickets in interval")) + (let ((l (copy-tree interval)) + (r nil)) + (while l + (setq r (append r `(,(rt-liber-report-scan-ticket (car l))))) + (setq l (cdr l))) + (setq r (sort r + #'(lambda (a b) + (string-lessp (car a) (car b))))) + r)) + +(defun rt-liber-report-count-by-date (l) + (let ((h (make-hash-table :test 'equal))) + (while l + (let ((d (or (gethash (caar l) h) 0))) + (puthash (caar l) (+ d 1) h)) + (setq l (cdr l))) + h)) + +(defun rt-liber-report-count-by-owner (l) + (let ((h (make-hash-table :test 'equal))) + (while l + (let ((d (or (gethash (cdar l) h) 0))) + (puthash (cdar l) (+ d 1) h)) + (setq l (cdr l))) + h)) + +(defun rt-liber-report (rt-queue start-date end-date) + (let ((tickets (rt-liber-report-scan-interval + (rt-liber-report-get-interval + rt-queue start-date end-date))) + by-date by-owner) + (when (not tickets) + (error (concat "no tickets in interval between " + start-date " and " end-date))) + (setq by-date (rt-liber-report-count-by-date tickets) + by-owner (rt-liber-report-count-by-owner tickets)))) (provide 'rt-report) -- cgit v1.2.3 From 26d77ec7855a31bfe1667276432ad33eefa06c09 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Mon, 12 Oct 2015 14:30:55 -0400 Subject: * rt-liberation-report.el: Complete first working version. --- rt-liberation-report.el | 51 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index 2e6a545..b2af361 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -73,32 +73,55 @@ return `nil'." (string-lessp (car a) (car b))))) r)) -(defun rt-liber-report-count-by-date (l) - (let ((h (make-hash-table :test 'equal))) +(defun rt-liber-report-count (f l) + (let (out) (while l - (let ((d (or (gethash (caar l) h) 0))) - (puthash (caar l) (+ d 1) h)) + (let* ((head (car l)) + (old-value (cdr (assoc (funcall f head) out)))) + (if old-value + (setcdr (assoc (funcall f head) out) (+ old-value 1)) + (setq out (append out `((,(funcall f head) . 1)))))) (setq l (cdr l))) - h)) + out)) + +(defun rt-liber-report-count-by-date (l) + (rt-liber-report-count #'car l)) (defun rt-liber-report-count-by-owner (l) - (let ((h (make-hash-table :test 'equal))) - (while l - (let ((d (or (gethash (cdar l) h) 0))) - (puthash (cdar l) (+ d 1) h)) - (setq l (cdr l))) - h)) + (rt-liber-report-count #'cdr l)) + +(defun rt-liber-report-print-csv (header l) + (let (out) + (with-temp-buffer + (insert (format "\n%s\n" header)) + (dolist (entry l) + (insert + (format "%s, %s\n" (car entry) (cdr entry)))) + (setq out (buffer-string))) + out)) (defun rt-liber-report (rt-queue start-date end-date) (let ((tickets (rt-liber-report-scan-interval (rt-liber-report-get-interval - rt-queue start-date end-date))) - by-date by-owner) + rt-queue end-date start-date))) + by-date by-owner + by-date-out + by-owner-out) (when (not tickets) (error (concat "no tickets in interval between " start-date " and " end-date))) + ;; collate (setq by-date (rt-liber-report-count-by-date tickets) - by-owner (rt-liber-report-count-by-owner tickets)))) + by-owner (rt-liber-report-count-by-owner tickets)) + ;; rank owners by resolved tickets + (setq by-owner + (sort + by-owner + #'(lambda (a b) + (> (cdr a) (cdr b))))) + ;; print + (insert (rt-liber-report-print-csv "date, resolved" by-date)) + (insert (rt-liber-report-print-csv "owner, resolved" by-owner)))) (provide 'rt-report) -- cgit v1.2.3 From e7779ce1381fe6e00c73f8e506b2870fff170e30 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Mon, 12 Oct 2015 17:33:38 -0400 Subject: * rt-liberation-report.el: Add Total, found bug. --- rt-liberation-report.el | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index b2af361..efb958b 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -50,10 +50,11 @@ return `nil'." (rt-liber-rest-run-ls-query (rt-liber-compile-query (and (queue rt-queue) - (resolved start-date end-date) + (resolved end-date start-date) (status "resolved")))))) (defun rt-liber-report-scan-ticket (ticket-alist) + "Convert TICKET-ALIST to set format." (let ((date-resolved (cdr (assoc "Resolved" ticket-alist))) (owner (cdr (assoc "Owner" ticket-alist)))) `(,(format-time-string "%d-%m-%Y" (date-to-time date-resolved)) @@ -74,6 +75,7 @@ return `nil'." r)) (defun rt-liber-report-count (f l) + "Apply function F to list L to produce a count." (let (out) (while l (let* ((head (car l)) @@ -84,13 +86,23 @@ return `nil'." (setq l (cdr l))) out)) +(defun rt-liber-report-count-total (l) + (let ((c 0)) + (while l + (setq c (+ c (cdr (car l)))) + (setq l (cdr l))) + c)) + (defun rt-liber-report-count-by-date (l) + "Count resolved tickets by date." (rt-liber-report-count #'car l)) (defun rt-liber-report-count-by-owner (l) + "Count resolved tickets by owner." (rt-liber-report-count #'cdr l)) (defun rt-liber-report-print-csv (header l) + "Output list L in a CSV format, starting with HEADER." (let (out) (with-temp-buffer (insert (format "\n%s\n" header)) @@ -101,12 +113,14 @@ return `nil'." out)) (defun rt-liber-report (rt-queue start-date end-date) + "Print tickets resolved between START-DATE and END-DATE." (let ((tickets (rt-liber-report-scan-interval (rt-liber-report-get-interval - rt-queue end-date start-date))) + rt-queue start-date end-date))) by-date by-owner by-date-out - by-owner-out) + by-owner-out + total) (when (not tickets) (error (concat "no tickets in interval between " start-date " and " end-date))) @@ -119,9 +133,12 @@ return `nil'." by-owner #'(lambda (a b) (> (cdr a) (cdr b))))) + ;; count total + (setq total (rt-liber-report-count-total by-owner)) ;; print (insert (rt-liber-report-print-csv "date, resolved" by-date)) - (insert (rt-liber-report-print-csv "owner, resolved" by-owner)))) + (insert (rt-liber-report-print-csv "owner, resolved" by-owner)) + (insert (format "\ntotal tickets resolved: %d\n" total)))) (provide 'rt-report) -- cgit v1.2.3 From f2d75b7be78ac2523dc2c8c4647d1bc7ee0ce6ed Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Mon, 12 Oct 2015 19:18:03 -0400 Subject: * rt-liberation-report.el: pass to main machine. --- rt-liberation-report.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index efb958b..203ae8a 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -57,7 +57,7 @@ return `nil'." "Convert TICKET-ALIST to set format." (let ((date-resolved (cdr (assoc "Resolved" ticket-alist))) (owner (cdr (assoc "Owner" ticket-alist)))) - `(,(format-time-string "%d-%m-%Y" (date-to-time date-resolved)) + `(,(format-time-string "%s" (date-to-time date-resolved)) . ,owner))) (defun rt-liber-report-scan-interval (interval) @@ -115,8 +115,10 @@ return `nil'." (defun rt-liber-report (rt-queue start-date end-date) "Print tickets resolved between START-DATE and END-DATE." (let ((tickets (rt-liber-report-scan-interval - (rt-liber-report-get-interval - rt-queue start-date end-date))) + ;; (rt-liber-report-get-interval + ;; rt-queue start-date end-date) + __foo + )) by-date by-owner by-date-out by-owner-out -- cgit v1.2.3 From a039fb5e0f471d11cebb9505a7916189e06db236 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Tue, 13 Oct 2015 15:32:47 -0400 Subject: * rt-liberation-report.el: Bump to other machine. --- rt-liberation-report.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index 203ae8a..d6f8182 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -66,6 +66,10 @@ return `nil'." (error "no tickets in interval")) (let ((l (copy-tree interval)) (r nil)) + + ;; the solution is to first convert to seconds, then sort, then + ;; finally convert to YYYY-MM-DD format + (while l (setq r (append r `(,(rt-liber-report-scan-ticket (car l))))) (setq l (cdr l))) -- cgit v1.2.3 From e3cc2f57ddfc5fb7392fa7889f138ef044d0e1ab Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Mon, 19 Oct 2015 16:52:08 -0400 Subject: * rt-liberation-report.el: Fix sorting bug. --- rt-liberation-report.el | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/rt-liberation-report.el b/rt-liberation-report.el index d6f8182..b5bd0b0 100644 --- a/rt-liberation-report.el +++ b/rt-liberation-report.el @@ -57,8 +57,7 @@ return `nil'." "Convert TICKET-ALIST to set format." (let ((date-resolved (cdr (assoc "Resolved" ticket-alist))) (owner (cdr (assoc "Owner" ticket-alist)))) - `(,(format-time-string "%s" (date-to-time date-resolved)) - . ,owner))) + `(,(float-time (date-to-time date-resolved)) . ,owner))) (defun rt-liber-report-scan-interval (interval) "Convert the list of tickets into an ordered format." @@ -66,16 +65,17 @@ return `nil'." (error "no tickets in interval")) (let ((l (copy-tree interval)) (r nil)) - - ;; the solution is to first convert to seconds, then sort, then - ;; finally convert to YYYY-MM-DD format - (while l (setq r (append r `(,(rt-liber-report-scan-ticket (car l))))) (setq l (cdr l))) + ;; sort the list when it is still in seconds format (setq r (sort r #'(lambda (a b) - (string-lessp (car a) (car b))))) + (< (car a) (car b))))) + ;; change the sorted list by day-date format, so that we can + ;; pigeon-hole count by day later on + (dolist (e r) + (setcar e (format-time-string "%Y-%m-%d" (car e)))) r)) (defun rt-liber-report-count (f l) @@ -119,10 +119,8 @@ return `nil'." (defun rt-liber-report (rt-queue start-date end-date) "Print tickets resolved between START-DATE and END-DATE." (let ((tickets (rt-liber-report-scan-interval - ;; (rt-liber-report-get-interval - ;; rt-queue start-date end-date) - __foo - )) + (rt-liber-report-get-interval + rt-queue start-date end-date))) by-date by-owner by-date-out by-owner-out -- cgit v1.2.3