This repository was archived by the owner on Sep 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatatypes.py
More file actions
45 lines (42 loc) · 2.13 KB
/
datatypes.py
File metadata and controls
45 lines (42 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from main import db
import datetime
class Purchases(db.Model):
id = db.Column('entry_id', db.Integer, primary_key = True)
category = db.Column(db.String(100))
amount = db.Column(db.Float)
globalWarmingPotential = db.Column(db.Float)
energyConsumption = db.Column(db.Float)
waterUsage = db.Column(db.Float)
dateAdded = db.Column(db.DateTime, nullable = False, default = datetime.datetime.utcnow)
def __init__(self, category = None, amount = None, globalWarmingPotential = None, energyConsumption = None, waterUsage = None):
self.category = category
self.amount = amount
self.globalWarmingPotential = globalWarmingPotential
self.energyConsumption = energyConsumption
self.waterUsage = waterUsage
def __repr__(self):
return "Purchase('{self.category}', '{self.amount}', '{self.globalWarmingPotential}', '{self.energyConsumption}', '{self.waterUsage}')"
class ReferenceValues(db.Model):
id = db.Column('entry_id', db.Integer, primary_key = True)
category = db.Column(db.String(100))
globalWarmingPotential = db.Column(db.Float)
energyConsumption = db.Column(db.Float)
waterUsage = db.Column(db.Float)
def __init__(self, category = None, globalWarmingPotential = None, energyConsumption = None, waterUsage = None):
self.category = category
self.globalWarmingPotential = globalWarmingPotential
self.energyConsumption = energyConsumption
self.waterUsage = waterUsage
def __repr__(self):
return "ReferenceValues('{self.category}', '{self.globalWarmingPotential}', '{self.energyConsumption}', '{self.waterUsage}')"
class ReferenceValuesUnits(db.Model):
id = db.Column('entry_id', db.Integer, primary_key = True)
globalWarmingPotential = db.Column(db.Float)
energyConsumption = db.Column(db.Float)
waterUsage = db.Column(db.Float)
def __init__(self, globalWarmingPotential = None, energyConsumption = None, waterUsage = None):
self.waterUsage = waterUsage
self.globalWarmingPotential = globalWarmingPotential
self.energyConsumption = energyConsumption
def __repr__(self):
return "ReferenceValues('{self.globalWarmingPotential}', '{self.energyConsumption}', '{self.waterUsage}')"