[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated: Remove (breaking) call
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated: Remove (breaking) call to old API. |
Date: |
Thu, 23 May 2019 14:25:06 +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 ef37242 Remove (breaking) call to old API.
ef37242 is described below
commit ef37242e94698d13ecdf2448c77a0fc3148918cb
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu May 23 14:24:38 2019 +0200
Remove (breaking) call to old API.
---
talerbank/app/tests.py | 21 +++++++++++++++++++++
talerbank/app/views.py | 14 +++++++++-----
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 2aa1c57..3a8dc26 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -48,6 +48,27 @@ def clear_db():
cursor.execute(
"ALTER SEQUENCE app_banktransaction_id_seq RESTART")
+class PublicAccountsTestCase(TestCase):
+ def setUp(self):
+ clear_db()
+ self.user = User.objects.create_user(
+ username="Bank",
+ password="Bank")
+ self.user.save()
+
+ self.user_bank_account = BankAccount(
+ account_no=100,
+ is_public = True,
+ user=self.user)
+
+ self.user_bank_account.save()
+
+ def test_public_accounts(self):
+ self.assertTrue(User.objects.get(username="Bank"))
+
+ response = self.client.get(
+ reverse("public-accounts", urlconf=urls))
+
class WithdrawTestCase(TestCase):
def setUp(self):
self.user_bank_account = BankAccount(
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 8f97acf..f4af47c 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -509,10 +509,14 @@ 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, # makes sign ignored.
- sign="+").count()
+ # How many records does a user have.
+ num_records = query_history(user.bankaccount,
+ "both",
+ # Note: the parameter below is used for
slicing arrays
+ # and django/python is not allowing slicing
with big numbers.
+ (UINT64_MAX / 2 ) / 2,
+ start=0,
+ sign="+").count()
DELTA = 30
# '//' operator is NO floating point.
num_pages = max(num_records // DELTA, 1)
@@ -523,7 +527,7 @@ def serve_public_accounts(request, name=None, page=None):
history = extract_history(user.bankaccount,
True,
DELTA * page,
- -1,
+ 0,
"+")[DELTA * (page - 1):(DELTA * page)]
pages = list(range(1, num_pages + 1))
--
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: Remove (breaking) call to old API.,
gnunet <=