summaryrefslogtreecommitdiff
path: root/talerbank/app/views.py
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-03-20 17:13:17 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2019-03-20 17:13:17 +0100
commit105f09c912fcb7ad9eab24210447e24aa895cafb (patch)
tree7c8146927b93d071d26b6364a9b76d4acf2cf7d5 /talerbank/app/views.py
parentbe54c581266645014807570b026953d3222bdeb1 (diff)
downloadbank-105f09c912fcb7ad9eab24210447e24aa895cafb.tar.gz
bank-105f09c912fcb7ad9eab24210447e24aa895cafb.tar.bz2
bank-105f09c912fcb7ad9eab24210447e24aa895cafb.zip
Fix #5636.
Diffstat (limited to 'talerbank/app/views.py')
-rw-r--r--talerbank/app/views.py42
1 files changed, 6 insertions, 36 deletions
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 32c1f8b..d3ff283 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -596,39 +596,6 @@ def query_history(bank_account,
sign,
descending=True):
- qs = query_history_raw(bank_account,
- direction,
- start,
- sign)
-
- order = "-id" if descending else "id"
- return qs.order_by(order)[:delta]
-
-
-
-##
-# Core routine for querying the history of a customer.
-#
-# @param bank_account the bank account object whose
-# history is being extracted.
-# @param direction takes the following three values,
-# * debit: only entries where the querying user has _paid_
-# will be returned.
-# * credit: only entries where the querying user _got_
-# paid will be returned.
-# * both: both of the cases above will be returned.
-# * cancel+: only entries where the querying user cancelled
-# the _receiving_ of money will be returned.
-# * cancel-: only entries where the querying user cancelled
-# the _paying_ of money will be returned.
-# @param start any history will be searched starting from this
-# value (which is a row ID), and going to the past or to
-# the future (depending on the user choice). However, this
-# value itself will not be included in the history.
-# @param sign this value ("+"/"-") determines whether the history
-# entries will be younger / older than @a start.
-# @return the query set (that will be typically further processed).
-def query_history_raw(bank_account, direction, start, sign):
direction_switch = {
"both": (Q(debit_account=bank_account) |
Q(credit_account=bank_account)),
@@ -641,13 +608,16 @@ def query_history_raw(bank_account, direction, start, sign):
}
sign_filter = {
- "+": Q(id__gt=start), # default
+ "+": Q(id__gt=start),
"-": Q(id__lt=start),
}
- return BankTransaction.objects.filter(
+ qs = BankTransaction.objects.filter(
direction_switch.get(direction),
- sign_filter.get(sign));
+ sign_filter.get(sign))
+
+ order = "-id" if descending else "id"
+ return qs.order_by(order)[:delta]
##