dodano funkcje increment_stat
This commit is contained in:
@@ -24,6 +24,13 @@ class baza():
|
||||
self.db = self.initDB(self.app, config)
|
||||
self.refresh_session()
|
||||
|
||||
def increment_stat(self, table: str, where: dict, column: str, value: int):
|
||||
with self.Session() as session:
|
||||
model = self.models[table]
|
||||
session.query(model).filter_by(**where).update({column: getattr(model, column) + value})
|
||||
session.commit()
|
||||
|
||||
|
||||
def initDB(self, app, config):
|
||||
global sportowcy, trofea, sportowcy_w_meczach, statystyki_sportowcow, kluby, mecze
|
||||
tnp = config['general']['db_prefix'] + "_lewangoalski_"
|
||||
|
||||
Reference in New Issue
Block a user