[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated: fix testcases.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated: fix testcases. |
Date: |
Thu, 06 Sep 2018 11:58:18 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new c1c942b fix testcases.
c1c942b is described below
commit c1c942b126d199bca4927bf692e21beab1cb326a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Sep 6 11:57:46 2018 +0200
fix testcases.
according to the always-in-descending-order policy of history retrieval.
---
talerbank/app/tests.py | 2 +-
talerbank/app/views.py | 18 ++++++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 43abd7c..7c246ec 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -400,7 +400,7 @@ class HistoryTestCase(TestCase):
delta="4", direction="both"),
HistoryContext(
expected_resp={
- "fields": [("row_id", 6)],
+ "fields": [("row_id", 9)],
"status": 200},
delta="+1", start="5", direction="both"),
HistoryContext(
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 99bd9e6..e0c3ed4 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -362,17 +362,23 @@ def serve_public_accounts(request, name=None, page=None):
if not user.bankaccount.is_public:
raise PrivateAccountException("Can't display public history for
private account")
- num_records = query_history_raw(user.bankaccount, "both", start=-1,
sign="-").count()
-
+ num_records = query_history_raw(user.bankaccount,
+ "both",
+ start=-1,
+ sign="-").count()
DELTA = 30
- youngest = 1 + DELTA * (page - 1)
+ # '//' operator is NO floating point.
+ num_pages = max(num_records // DELTA, 1)
+ start_row = 1 + (DELTA * (page - 1))
public_accounts = BankAccount.objects.filter(is_public=True)
- # Retrieve DELTA records, starting from 'youngest'
- history = extract_history(user.bankaccount, DELTA, youngest - 1, "+")
+ # Retrieve DELTA records younger than 'start_row' (included).
+ history = extract_history(user.bankaccount,
+ DELTA,
+ start_row - 1,
+ "+") # takes results youger than 'start_row'
- num_pages = max(num_records // DELTA, 1)
pages = list(range(1, num_pages + 1))
context = dict(
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-bank] branch master updated: fix testcases.,
gnunet <=