[billreminder] Chart data should now match what is displayed on timeline and list views.
- From: Og B. Maciel <ogmaciel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [billreminder] Chart data should now match what is displayed on timeline and list views.
- Date: Mon, 7 Dec 2009 19:12:33 +0000 (UTC)
commit 678ba1806f7a15172fd31bf1ad5750b9657ed7b4
Author: Og B. Maciel <ogmaciel gnome org>
Date: Mon Dec 7 13:37:57 2009 -0500
Chart data should now match what is displayed on timeline and list views.
src/gui/maindialog.py | 5 ++---
src/lib/actions.py | 7 ++++---
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/maindialog.py b/src/gui/maindialog.py
index e7a393f..66fd436 100644
--- a/src/gui/maindialog.py
+++ b/src/gui/maindialog.py
@@ -181,7 +181,6 @@ class MainDialog:
def reloadTreeView(self, *arg):
# Update list with updated record
status = self.gconf_client.get_int(GCONF_GUI_PATH + 'show_paid_bills')
- print "Status is: %s" % status
#month = self.timeline.value.month
#year = self.timeline.value.year
@@ -230,7 +229,7 @@ class MainDialog:
categories = []
totals = []
- records = self.actions.get_monthly_totals(start, end)
+ records = self.actions.get_monthly_totals(start, end, status)
# Chart widget takes data in format (('CategoryName', amount),)
categories = [cat or 'None' for cat, total in records]
totals = [float(total) for cat,total in records]
@@ -238,7 +237,7 @@ class MainDialog:
# set bar colors
all_categories = self.actions.get_categories()
- self.chart.chart.key_colors = dict([(cat.name, cat.color) for cat in all_categories])
+ self.chart.chart.key_colors = dict([(cat.name or 'None', cat.color) for cat in all_categories])
self.chart.plot(categories, totals)
diff --git a/src/lib/actions.py b/src/lib/actions.py
index 0362184..b37e2df 100644
--- a/src/lib/actions.py
+++ b/src/lib/actions.py
@@ -33,7 +33,7 @@ class Actions(object):
try:
session = self.dal.Session()
q = session.query(Bill).options(eagerload('category')).filter(Bill.dueDate >= start).filter(Bill.dueDate <= end)
- if paid != None:
+ if paid is not None:
q = q.filter(Bill.paid == paid)
records = q.order_by(Bill.dueDate.desc()).all()
except Exception, e:
@@ -51,12 +51,13 @@ class Actions(object):
records = []
+ paid = bool(paid) if paid in (0,1) else None
+
try:
session = self.dal.Session()
# records is a tuple of Category.name and total as type Decimal
q = session.query(Category.name, func.sum(Bill.amount)).select_from(outerjoin(Bill, Category)).filter(Bill.dueDate >= start).filter(Bill.dueDate <= end).group_by(Category.name)
-
- if paid:
+ if paid is not None:
q = q.filter(Bill.paid == paid)
records = q.all()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]