fixed BUG for deleting and adding new bill type, stupidly did not roll which_growth into the insert code
This commit is contained in:
2
BUGS
2
BUGS
@@ -1,5 +1,3 @@
|
|||||||
* cannot remove bill type (Kayo) - OR (TODO): modify it to yearly from monthly
|
|
||||||
|
|
||||||
* can put in dumb dates - DO SOME INPUT VALIDATION, *sigh*
|
* can put in dumb dates - DO SOME INPUT VALIDATION, *sigh*
|
||||||
- e.g. 0026-02-19 for a Gas bill
|
- e.g. 0026-02-19 for a Gas bill
|
||||||
|
|
||||||
|
|||||||
4
db.py
4
db.py
@@ -100,6 +100,7 @@ def init_db():
|
|||||||
ann_growth_avg REAL,
|
ann_growth_avg REAL,
|
||||||
ann_growth_max REAL,
|
ann_growth_max REAL,
|
||||||
ann_growth_simple REAL,
|
ann_growth_simple REAL,
|
||||||
|
which_growth STRING,
|
||||||
FOREIGN KEY(freq) REFERENCES bill_freq(id)
|
FOREIGN KEY(freq) REFERENCES bill_freq(id)
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@@ -379,7 +380,7 @@ def insert_bill_type( bt, fq ):
|
|||||||
conn = connect_db(False)
|
conn = connect_db(False)
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
print( f"fq={fq}" )
|
print( f"fq={fq}" )
|
||||||
cur.execute( f"insert into bill_type ( 'name', 'freq', 'ann_growth_min', 'ann_growth_avg', 'ann_growth_max', 'ann_growth_simple' ) values ( '{bt}', {fq}, 0, 0, 0, 0 )" )
|
cur.execute( f"insert into bill_type ( name, freq, ann_growth_min, ann_growth_avg, ann_growth_max, ann_growth_simple, which_growth ) values ( '{bt}', {fq}, 0, 0, 0, 0, 'cpi' )" )
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
return
|
return
|
||||||
@@ -403,6 +404,7 @@ def delete_bill(id):
|
|||||||
def delete_bill_type( id ):
|
def delete_bill_type( id ):
|
||||||
conn = connect_db(False)
|
conn = connect_db(False)
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
cur.execute( f"delete from bill_data where bill_type = '{id}'" )
|
||||||
cur.execute( f"delete from bill_type where id = '{id}'" )
|
cur.execute( f"delete from bill_type where id = '{id}'" )
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user