[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated: fix off-by-one /history
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated: fix off-by-one /history error |
Date: |
Tue, 16 Jan 2018 11:51:31 +0100 |
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 91abe5e fix off-by-one /history error
91abe5e is described below
commit 91abe5eb99ff471fe981e3b2479341321b68fcd7
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jan 16 11:51:12 2018 +0100
fix off-by-one /history error
---
talerbank/app/views.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 62f76b1..d5ad6fe 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -425,7 +425,9 @@ def login_via_headers(view_func):
# 'delta': how many results are going to be extracted. If 'None'
# is given, no filter of this kind will be applied.
# 'start': a "id" indicating the first record to be returned.
-# If -1 is given, then the first record will be the youngest.
+# If -1 is given, then the first record will be the youngest
+# and 'delta' records will be returned, _regardless_ of the
+# 'sign' being passed.
# 'sign': (+|-) indicating that we want records younger|older
# than 'start'.
@@ -443,15 +445,11 @@ def query_history(bank_account, direction, delta, start,
sign):
sign_filter = {
"+": Q(id__gt=start),
"-": Q(id__lt=start),
- "*": Q(),
- "x": not Q(),
}
# Handle special case.
- if start == -1: # can only retrieve older records.
- sign = "*"
- if sign == "+": # no result is younger than the youngest.
- sign = "x"
+ if start == -1: # return 'delta' youngest records.
+ sign = "+"
return BankTransaction.objects.filter(
direction_switch.get(direction),
--
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 off-by-one /history error,
gnunet <=