Fix user transaction error and other unexpected behaviour

This commit is contained in:
robertem 2018-04-22 15:44:24 +00:00
parent 17c2d05294
commit 31e3442c7c
3 changed files with 4 additions and 4 deletions

View File

@ -92,8 +92,8 @@ much money you're due in credits for the purchase when prompted.\n'''
def perform_transaction(self): def perform_transaction(self):
print 'Did you pay a different price?' print 'Did you pay a different price?'
if self.confirm('>', default=True): if self.confirm('>', default=False):
price = self.input_int() price = self.input_int('How much did you pay?', default=self.price)
if price > self.price: if price > self.price:
print 'Illegal action, total can not be higher than your total.' print 'Illegal action, total can not be higher than your total.'
else: else:

View File

@ -34,7 +34,7 @@ class TransferMenu(Menu):
print 'Transfered %d kr from %s to %s' % (amount, user1, user2) print 'Transfered %d kr from %s to %s' % (amount, user1, user2)
print 'User %s\'s credit is now %d kr' % (user1, user1.credit) print 'User %s\'s credit is now %d kr' % (user1, user1.credit)
print 'User %s\'s credit is now %d kr' % (user2, user2.credit) print 'User %s\'s credit is now %d kr' % (user2, user2.credit)
print 'Comment: $s' % comment print 'Comment: %s' % comment
except sqlalchemy.exc.SQLAlchemyError, e: except sqlalchemy.exc.SQLAlchemyError, e:
print 'Could not perform transfer: %s' % e print 'Could not perform transfer: %s' % e
# self.pause() # self.pause()

View File

@ -18,7 +18,7 @@ Put it up somewhere in the vicinity.
def _execute(self): def _execute(self):
self.print_header() self.print_header()
thing = self.input_thing('Prodct/User> ') thing = self.input_thing('Product/User> ')
if isinstance(thing, Product): if isinstance(thing, Product):
if re.match(r"^[0-9]{13}$", thing.bar_code): if re.match(r"^[0-9]{13}$", thing.bar_code):