Blackjack ledger works

This commit is contained in:
2023-06-09 20:51:57 +10:00
parent 95ff2e7e46
commit e8c1fbb73b
8 changed files with 22 additions and 14 deletions

View File

@@ -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