From: Andrew Gozzard Date: Thu, 28 Feb 2013 10:40:23 +0000 (+0800) Subject: Done added coke pricechecking X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;ds=inline;p=zanchey%2Fdispense2.git Done added coke pricechecking --- diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index 8d62489..0126063 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -463,7 +463,9 @@ def make_selection(v, vstatus): def price_check(v, vstatus): if vstatus.cur_selection[1] == '8': - v.display(center('SEE COKE')) + args = ('dispense', 'iteminfo', 'coke:' + vstatus.cur_selection[0]) + info, unused = Popen(args, close_fds=True, stdout=PIPE).communicate() + dollarprice = re.match("\s*[a-z]+:\d+\s+(\d+\.\d\d)\s+([^\n]+)", info).group(1) else: # first see if it's a named slot try: @@ -471,7 +473,7 @@ def price_check(v, vstatus): except: price, shortname, name = get_snack( '--' ) dollarprice = "$%.2f" % ( price / 100.0 ) - v.display(vstatus.cur_selection+' - %s'%dollarprice) + v.display(vstatus.cur_selection+' - %s'%dollarprice) def handle_getting_pin_key(state, event, params, v, vstatus):