aboutsummaryrefslogtreecommitdiff
path: root/budget/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'budget/models.py')
-rw-r--r--budget/models.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/budget/models.py b/budget/models.py
index 55a97c1..727200f 100644
--- a/budget/models.py
+++ b/budget/models.py
@@ -17,11 +17,11 @@ class Project(db.Model):
_to_serialize = ("id", "name", "password", "contact_email",
"members", "active_members", "balance")
- id = db.Column(db.String, primary_key=True)
+ id = db.Column(db.String(64), primary_key=True)
name = db.Column(db.UnicodeText)
- password = db.Column(db.String)
- contact_email = db.Column(db.String)
+ password = db.Column(db.String(128))
+ contact_email = db.Column(db.String(128))
members = db.relationship("Person", backref="project")
@property
@@ -62,7 +62,7 @@ class Project(db.Model):
debts.append({"person": person, "balance": -balance[person.id]})
# Try and find exact matches
for credit in credits:
- match = self.exactmatch(credit["balance"], debts)
+ match = self.exactmatch(round(credit["balance"], 2), debts)
if match:
for m in match:
transactions.append({"ower": m["person"], "receiver": credit["person"], "amount": m["balance"]})
@@ -155,7 +155,7 @@ class Person(db.Model):
_to_serialize = ("id", "name", "activated")
id = db.Column(db.Integer, primary_key=True)
- project_id = db.Column(db.String, db.ForeignKey("project.id"))
+ project_id = db.Column(db.String(64), db.ForeignKey("project.id"))
bills = db.relationship("Bill", backref="payer")
name = db.Column(db.UnicodeText)
@@ -230,7 +230,7 @@ class Bill(db.Model):
class Archive(db.Model):
id = db.Column(db.Integer, primary_key=True)
- project_id = db.Column(db.String, db.ForeignKey("project.id"))
+ project_id = db.Column(db.String(64), db.ForeignKey("project.id"))
name = db.Column(db.UnicodeText)
@property