summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--talerbank/app/tests.py10
-rw-r--r--talerbank/app/views.py10
2 files changed, 9 insertions, 11 deletions
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 61d2639..695ef33 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -411,17 +411,17 @@ class HistoryTestCase(TestCase):
for ctx in (
HistoryContext(
expected_resp={"status": 200},
- delta="4", direction="both"),
+ delta="-4", direction="both"),
HistoryContext(
expected_resp={
- "fields": [("row_id", 6)],
+ "fields": [("row_id", 9)],
"status": 200},
delta="+1", start="5", direction="both"),
HistoryContext(
expected_resp={
"fields": [("wt_subject", "a")],
"status": 200},
- delta="-1", start=9, direction="both"),
+ delta="-1", start=2, direction="both"),
HistoryContext(
expected_resp={"status": 204},
delta="1", start="11", direction="both"),
@@ -442,7 +442,7 @@ class HistoryTestCase(TestCase):
expected_resp={"status": 204},
delta="+1", direction="cancel+"),
HistoryContext(expected_resp={"status": 200},
- delta="+1", direction="debit")):
+ delta="-1", direction="debit")):
response = self.client.get(
reverse("history", urlconf=urls), ctx.urlargs,
**{"HTTP_X_TALER_BANK_USERNAME": "User",
@@ -680,7 +680,7 @@ class BalanceTestCase(TestCase):
response = self.client.get(
reverse("history", urlconf=urls),
{"auth": "basic",
- "delta": 30,
+ "delta": -30,
"direction": "both",
"account_number": 55}, # unused
**{"HTTP_X_TALER_BANK_USERNAME": "U0",
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 9583dff..7a974df 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -44,6 +44,8 @@ from .amount import Amount
from .schemas import validate_data
LOGGER = logging.getLogger(__name__)
+MAX_UINT64 = (2**64) - 1
+
class LoginFailed(Exception):
hint = "Wrong username/password"
http_status_code = 401
@@ -421,7 +423,7 @@ def query_history(bank_account,
delta,
start,
sign,
- descending=False):
+ descending=True):
qs = query_history_raw(bank_account,
direction,
@@ -449,10 +451,6 @@ def query_history_raw(bank_account, direction, start, sign):
"-": Q(id__lt=start),
}
- # Handle special case.
- if start < 0: # return all the records.
- sign = "+"
-
return BankTransaction.objects.filter(
direction_switch.get(direction),
sign_filter.get(sign));
@@ -474,7 +472,7 @@ def serve_history(request, user_account):
qs = query_history(user_account.bankaccount,
request.GET.get("direction"),
int(parsed_delta.group(2)),
- int(request.GET.get("start", -1)),
+ int(request.GET.get("start", MAX_UINT64)),
sign if sign else "+")
history = []