Permalink
Browse files

SQLite returns a float from TOTAL even if you run it on an integer co…

…lumn. So I have to explicitly check if columns in my ListStores are integers or not, and then take special care of them.
  • Loading branch information...
dumbmatter committed Jan 28, 2012
1 parent 40c30a4 commit 3fdfebd1b2e8738106d264da8220abfa78de9372
Showing with 11 additions and 3 deletions.
  1. +10 −2 bbgm/common.py
  2. +1 −1 bbgm/views/main_window.py
View
@@ -1,4 +1,5 @@
from gi.repository import Gtk
from gi.repository import GObject
import os
# When DEBUG is True:
@@ -148,9 +149,16 @@ def treeview_update_new(treeview, query_ids, params_ids, query_row, params_row,
values = []
for j in range(0, len(row)):
if row[j] == None:
values.append(0.0)
# Make sure to pass an int to an int column and a float to a float column
if liststore.get_column_type(j) == GObject.TYPE_INT:
values.append(0)
else:
values.append(0.0)
else:
values.append(row[j])
if liststore.get_column_type(j) == GObject.TYPE_INT:
values.append(int(row[j]))
else:
values.append(row[j])
# Add a new row or update an existing row?
if not found_row_id:
@@ -301,8 +301,8 @@ def update_all_pages(self):
self.updated[key] = False
self.standings.updated = False
self.finances.updated = False
## TEMPORARY FOR PORTING
# self.finances.updated = False
# self.player_ratings.updated = False
# self.player_stats.updated = False
# self.team_stats.updated = False

0 comments on commit 3fdfebd

Please sign in to comment.