Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
plushkatze
foobarpay
Commits
f746895c
Commit
f746895c
authored
Apr 07, 2016
by
anthraxx
Browse files
reset state to "welcome" on unknown user after 3 seconds
parent
c7ab4b4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
foobarpay/logic.py
View file @
f746895c
...
...
@@ -20,8 +20,9 @@ class Logic(object):
self
.
allow_customer_creation
=
allow_customer_creation
self
.
reset
()
def
reset
(
self
):
def
reset
(
self
,
sleep_duration
=
0
):
logging
.
debug
(
"Resetting logic"
)
sleep
(
sleep_duration
)
self
.
state
=
self
.
State
.
Idle
self
.
cart
=
0
self
.
customer
=
None
...
...
@@ -36,6 +37,7 @@ class Logic(object):
if
self
.
customer
is
None
:
logging
.
warn
(
"Unknown customer id: {}"
.
format
(
customer_id
))
self
.
display
.
show_two_messages
(
"Error"
,
"Unknown id"
)
self
.
reset
(
3
)
return
logging
.
debug
(
"Name: {}"
.
format
(
self
.
customer
.
name
))
logging
.
debug
(
"Saldo: {}"
.
format
(
self
.
customer
.
saldo
))
...
...
@@ -50,8 +52,7 @@ class Logic(object):
self
.
customer
.
modify_saldo
(
self
.
cart
)
self
.
database
.
commit
()
self
.
display
.
show_two_messages
(
"Transaction"
,
"completed"
)
sleep
(
3
)
self
.
reset
()
self
.
reset
(
3
)
def
handle_scanned_text
(
self
,
scanned_text
):
try
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment