diff --git a/data b/data index 85b02e3..d16a14f 100644 Binary files a/data and b/data differ diff --git a/text_based.py b/text_based.py index 6035a64..742b7fb 100755 --- a/text_based.py +++ b/text_based.py @@ -6,6 +6,7 @@ from sqlalchemy.sql import func from sqlalchemy import desc import re, sys, os, traceback, signal, readline from helpers import * +import datetime exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q'] help_commands = ['help', '?'] @@ -16,6 +17,11 @@ restart_commands = ['restart'] low_credit_warning_limit = -100 +def time(): + now=datetime.datetime.now() + out=str(now.day)+'-'+str(now.month)+'-'+str(now.year) + return(out) + class ExitMenu(Exception): pass @@ -135,6 +141,7 @@ class Menu(): continue if result in context_commands: self.show_context() + print 'hei hello' continue if result in faq_commands: FAQMenu().execute() @@ -851,10 +858,15 @@ When finished, write an empty line to confirm the purchase. self.print_purchase() for t in self.purchase.transactions: print 'User %s\'s credit is now %d kr' % (t.user.name, t.user.credit) - if (t.user.credit < low_credit_warning_limit and thing.card != '42'): + if (t.user.credit < low_credit_warning_limit and t.user.card != '11122233'): print ('USER %s HAS LOWER CREDIT THAN %d, AND SHOULD CONSIDER PUTTING SOME MONEY IN THE BOX.' % (t.user.name, low_credit_warning_limit)) - self.pause() + self.pause() + #skriver til log + #print Product.price + #with open("dibbler-out.txt", "a") as f: + # f.write("purchase|"+ time() +"|"+self.purchase.entries[0].product.name+"|"+t.user.name+"|+str(Product.price)+|"+'-1'+"|\n") + return True def complete_input(self): @@ -1062,6 +1074,9 @@ def restart(): if not conf.stop_allowed: signal.signal(signal.SIGTSTP, signal.SIG_IGN) + + + main = Menu('Dibbler main menu', items=[BuyMenu(), ProductListMenu(),