client-barcode: Split Status.commit() up into sub-functions

master
Sebastian Pipping 13 years ago
parent 27962ad107
commit 156a0df88d

@ -267,7 +267,7 @@ class Status:
def commit(self):
assert(self.logged_in())
# Compress DepositCommands
def compress_deposit_commands():
dummy, initial_balance = self.transfers[0]
balance_before = initial_balance
compressed_deposit = DepositCommand(Decimal('0'))
@ -282,10 +282,10 @@ class Status:
others.append((compressed_deposit, balance_before))
self.transfers = others
def process_buy_commands_combined():
# Compress BuyCommands, use a single bulkbuy
dummy, initial_balance = self.transfers[0]
balance_before = initial_balance
buy_commands = list()
non_buy_commands = list()
total_buy_diff = 0
@ -305,7 +305,7 @@ class Status:
else:
self.transfers = non_buy_commands
# Process remaining command queue
def process_commands():
for (command, balance_backup) in list(self.transfers):
try:
command.run(self.login_name)
@ -316,6 +316,7 @@ class Status:
else:
self.transfers.pop(0)
def finish():
if not self.transfers:
# Show final balance for some time
clear()
@ -324,6 +325,10 @@ class Status:
self.logout()
compress_deposit_commands()
process_buy_commands_combined()
process_commands()
finish()
def find(self, barcode):
try:

Loading…
Cancel
Save