Browse Source

org-effectiveness.el (org-effectiveness-plot-ascii): fixed the problem changing the year in org-effectivenss-plot-ascii

* org-effectiveness.el (org-effectiveness-plot-ascii): fixed the problem changing the year in org-effectivenss-plot-ascii

TINYCHANGE
David Arroyo Menendez 11 years ago
parent
commit
48dd94cc39
1 changed files with 10 additions and 9 deletions
  1. 10 9
      contrib/lisp/org-effectiveness.el

+ 10 - 9
contrib/lisp/org-effectiveness.el

@@ -224,21 +224,22 @@ many TODO pending"
 (defun org-effectiveness-plot-ascii (startdate enddate)
   (interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
   (setq dates (org-effectiveness-check-dates startdate enddate))
-  (setq syear (cadr (assoc 'startyear dates)))
-  (setq smonth (cadr (assoc 'startmonth dates)))
-  (setq eyear (cadr (assoc 'endyear dates)))
-  (setq emonth (cadr (assoc 'endmonth dates)))
 ;;  (switch-to-buffer "*org-effectiveness*")
-  (let ((month smonth)
-  	(year syear)
+  (let ((syear (cadr (assoc 'startyear dates)))
+	(smonth (cadr (assoc 'startmonth dates)))
+  	(year (cadr (assoc 'startyear dates)))
+	(month (cadr (assoc 'startmonth dates)))
+	(emonth (cadr (assoc 'endmonth dates)))
+	(eyear (cadr (assoc 'endyear dates)))
   	(str ""))
-    (while (and (>= eyear year) (>= emonth month))
+    (while (or (>= eyear year) (and (= eyear year) (>= emonth month)))
       (org-effectiveness-ascii-bar (string-to-number (org-effectiveness-in-date (concat (number-to-string year) "-" (org-effectiveness-month-to-string month)) 1)) (format "%s-%s" year month))
-      (if (= month 12)
+      (if (eq month 12)
   	  (progn 
   	    (setq year (+ 1 year))
   	    (setq month 1))
-  	(setq month (+ 1 month))))))
+  	(setq month (+ 1 month))))
+))
 
 (provide 'org-effectiveness)