Blackjack ledger works
This commit is contained in:
12
Ledger.py
12
Ledger.py
@@ -14,8 +14,9 @@ class Database():
|
||||
self.data.execute(insertQuery, (ID,))
|
||||
self.db.commit()
|
||||
|
||||
def update(self, data, newData, updateQuery):
|
||||
def update(self, ID, data, newData, updateQuery):
|
||||
data = [data[i] + newData[i] for i in range(len(data))]
|
||||
data.append(ID)
|
||||
self.data.execute(updateQuery, data)
|
||||
|
||||
class Ledger(Database):
|
||||
@@ -37,15 +38,16 @@ class Ledger(Database):
|
||||
def write(self, ID):
|
||||
insertQuery = """ INSERT INTO ledger(USERID)
|
||||
VALUES(?) """
|
||||
super().read(ID, insertQuery)
|
||||
super().write(ID, insertQuery)
|
||||
|
||||
def update(self, data, newData):
|
||||
def update(self, ID, newData):
|
||||
query = """ UPDATE ledger
|
||||
SET MONEY = ?,
|
||||
WINS = ?,
|
||||
LOSSES = ?,
|
||||
LOSSES = ?
|
||||
WHERE USERID = ?"""
|
||||
super().update(data, newData, query)
|
||||
data = list(self.read(ID))[1:]
|
||||
super().update(ID, data, newData, query)
|
||||
|
||||
def main():
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user