-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.py
80 lines (52 loc) · 2.29 KB
/
console.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# - Import de-bugging tools, models and repositories
import pdb
from models.transaction import Transaction
import repositories.transaction_repository as transaction_repository
from models.amount import Amount
import repositories.amount_repository as amount_repository
from models.merchant import Merchant
import repositories.merchant_repository as merchant_repository
from models.merchant_type import MerchantType
import repositories.merchant_type_repository as merchant_type_repository
from models.user_budget import UserBudget
import repositories.user_budget_repository as user_budget_repository
# - Clear all tables in the project database
transaction_repository.delete_all()
amount_repository.delete_all()
merchant_repository.delete_all()
merchant_type_repository.delete_all()
user_budget_repository.delete_all()
# - Initial data which seeds to database
amount_1 = Amount(50.50)
amount_repository.save(amount_1)
# ---- EXTENSION WORK 18/12/2020 ADDED/REMOVED AMOUNT_1 TO MAKE LESS CONFUSING AS WAS POPULATING THE DB NOT IN A TRANSACTION
amount_2 = Amount(200.35)
amount_repository.save(amount_2)
amount_3 = Amount(55)
amount_repository.save(amount_3)
amount_4 = Amount(150)
amount_repository.save(amount_4)
merchant_type_1 = MerchantType("Groceries")
merchant_type_repository.save(merchant_type_1)
merchant_type_2 = MerchantType("Entertainment")
merchant_type_repository.save(merchant_type_2)
merchant_type_3 = MerchantType("General Subscription")
merchant_type_repository.save(merchant_type_3)
merchant_1 = Merchant("Amazon", merchant_type_2)
merchant_repository.save(merchant_1)
merchant_2 = Merchant("Sainsbury's", merchant_type_1)
merchant_repository.save(merchant_2)
merchant_3 = Merchant("Spotify", merchant_type_3)
merchant_repository.save(merchant_3)
transaction_1 = Transaction(amount_2, merchant_2)
transaction_repository.save(transaction_1)
transaction_2 = Transaction(amount_1, merchant_1)
transaction_repository.save(transaction_2)
transaction_3 = Transaction(amount_3, merchant_2)
transaction_repository.save(transaction_3)
transaction_4 = Transaction(amount_4, merchant_2)
transaction_repository.save(transaction_4)
user_budget = UserBudget(0)
user_budget_repository.save(user_budget)
# - Uncomment the below line to run the de-bugger when implementing and testing new functionality
# pdb.set_trace()