|
|
|
@ -261,6 +261,21 @@ class Status:
@@ -261,6 +261,21 @@ class Status:
|
|
|
|
|
def commit(self): |
|
|
|
|
assert(self.logged_in()) |
|
|
|
|
|
|
|
|
|
# Compress DepositCommands |
|
|
|
|
dummy, initial_balance = self.transfers[0] |
|
|
|
|
balance_before = initial_balance |
|
|
|
|
compressed_deposit = DepositCommand(Decimal('0')) |
|
|
|
|
others = list() |
|
|
|
|
for (command, dummy) in list(self.transfers): |
|
|
|
|
if isinstance(command, DepositCommand): |
|
|
|
|
compressed_deposit.add(command) |
|
|
|
|
else: |
|
|
|
|
others.append((command, balance_before)) |
|
|
|
|
balance_before += command.difference() |
|
|
|
|
if compressed_deposit.difference() != 0: |
|
|
|
|
others.append((compressed_deposit, balance_before)) |
|
|
|
|
self.transfers = others |
|
|
|
|
|
|
|
|
|
# Process command queue |
|
|
|
|
for (command, balance_backup) in list(self.transfers): |
|
|
|
|
try: |
|
|
|
|