Skip to content

Commit

Permalink
Remove unnecessary explicit commits to the database
Browse files Browse the repository at this point in the history
  • Loading branch information
sde1000 committed Jan 28, 2025
1 parent 8da2e49 commit 119177e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
6 changes: 0 additions & 6 deletions quicktill/barcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def stockline(self, code):
def _finish_stockline(self, code, stockline):
binding = self._clear_binding(code)
binding.stockline = stockline
td.s.commit()
_barcode_change_confirmed(
[f'Barcode {code} is now assigned to stock line "{stockline}".'])

Expand All @@ -183,7 +182,6 @@ def plu(self, code):
def _finish_plu(self, code, plu):
binding = self._clear_binding(code)
binding.plu = plu
td.s.commit()
_barcode_change_confirmed(
[f'Barcode {code} is now assigned to price lookup "{plu}".'])

Expand All @@ -194,7 +192,6 @@ def stocktype(self, code):
def _finish_stocktype(self, code, st):
binding = self._clear_binding(code)
binding.stocktype = st
td.s.commit()
_barcode_change_confirmed(
[f'Barcode {code} is now assigned to stock type "{st}".'])

Expand All @@ -204,7 +201,6 @@ def modifier(self, code):
def _finish_modifier(self, code, m):
binding = self._clear_binding(code)
binding.modifier = m
td.s.commit()
_barcode_change_confirmed(
[f'Barcode {code} is now assigned to modifier "{m}".'])

Expand All @@ -217,7 +213,6 @@ def _finish_defmodifier(self, code, m):
binding = b.binding
if binding:
binding.modifier = m
td.s.commit()
_barcode_change_confirmed(
[f'Barcode {code} now has default modifier "{m}".'])
else:
Expand All @@ -228,5 +223,4 @@ def remove(self, code):
b = barcode(code)
if b.binding:
td.s.delete(b.binding)
td.s.commit()
_barcode_change_confirmed([f"Barcode {code} has been removed."])
1 change: 0 additions & 1 deletion quicktill/till.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ def run(args):
td.s.add(reg)
td.s.flush()
tillconfig.register_id = reg.id
td.s.commit()

dbg_kbd = None
try:
Expand Down
1 change: 0 additions & 1 deletion quicktill/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,6 @@ def usersmenu():
def reactivate_user(userid):
u = td.s.get(User, userid)
u.enabled = True
td.s.commit()
ui.toast(f'User "{u.fullname}" reactivated.')
log(f"Reactivated user {u.logref}")
edituser(userid)
Expand Down

0 comments on commit 119177e

Please sign in to comment.