clean some comments
- fix: error if actions are empty in balance stats
This commit is contained in:
parent
6d2e150aa0
commit
10d2b58fa7
1 changed files with 16 additions and 25 deletions
|
@ -2049,9 +2049,10 @@ class PkUrlMixin(object):
|
|||
|
||||
|
||||
class SingleResumeStat(JSONDetailView):
|
||||
"""
|
||||
Summarize all the stats of an object
|
||||
Handles JSONResponse
|
||||
"""Manifest for a kind of a stat about an object.
|
||||
|
||||
Returns JSON whose payload is an array containing descriptions of a stat:
|
||||
url to retrieve data, label, ...
|
||||
|
||||
"""
|
||||
id_prefix = ''
|
||||
|
@ -2095,9 +2096,8 @@ class SingleResumeStat(JSONDetailView):
|
|||
ID_PREFIX_ACC_BALANCE = "balance_acc"
|
||||
|
||||
|
||||
# Un résumé de toutes les vues ArticleStatBalance
|
||||
# REND DU JSON
|
||||
class AccountStatBalanceList(PkUrlMixin, SingleResumeStat):
|
||||
"""Manifest for balance stats of an account."""
|
||||
model = Account
|
||||
context_object_name = 'account'
|
||||
pk_url_kwarg = 'trigramme'
|
||||
|
@ -2138,12 +2138,10 @@ class AccountStatBalanceList(PkUrlMixin, SingleResumeStat):
|
|||
|
||||
|
||||
class AccountStatBalance(PkUrlMixin, JSONDetailView):
|
||||
"""
|
||||
Returns a JSON containing the evolution a the personnal
|
||||
balance of a trigramme between timezone.now() and `nb_days`
|
||||
ago (specified to the view as an argument)
|
||||
takes into account the Operations and the Transfers
|
||||
does not takes into account the balance offset
|
||||
"""Datasets of balance of an account.
|
||||
|
||||
Operations and Transfers are taken into account.
|
||||
|
||||
"""
|
||||
model = Account
|
||||
pk_url_kwarg = 'trigramme'
|
||||
|
@ -2253,8 +2251,9 @@ class AccountStatBalance(PkUrlMixin, JSONDetailView):
|
|||
"values": changes,
|
||||
}]
|
||||
context['is_time_chart'] = True
|
||||
context['min_date'] = changes[-1]['at']
|
||||
context['max_date'] = changes[0]['at']
|
||||
if len(changes) > 0:
|
||||
context['min_date'] = changes[-1]['at']
|
||||
context['max_date'] = changes[0]['at']
|
||||
# TODO: offset
|
||||
return context
|
||||
|
||||
|
@ -2278,9 +2277,8 @@ ID_PREFIX_ACC_LAST_WEEKS = "last_weeks_acc"
|
|||
ID_PREFIX_ACC_LAST_MONTHS = "last_months_acc"
|
||||
|
||||
|
||||
# Un résumé de toutes les vues ArticleStatLast
|
||||
# NE REND PAS DE JSON
|
||||
class AccountStatOperationList(PkUrlMixin, SingleResumeStat):
|
||||
"""Manifest for operations stats of an account."""
|
||||
model = Account
|
||||
context_object_name = 'account'
|
||||
pk_url_kwarg = 'trigramme'
|
||||
|
@ -2301,10 +2299,7 @@ class AccountStatOperationList(PkUrlMixin, SingleResumeStat):
|
|||
|
||||
|
||||
class AccountStatOperation(ScaleMixin, PkUrlMixin, JSONDetailView):
|
||||
"""
|
||||
Returns a JSON containing the evolution a the personnal
|
||||
consommation of a trigramme at the diffent dates specified
|
||||
"""
|
||||
"""Datasets of operations of an account."""
|
||||
model = Account
|
||||
pk_url_kwarg = 'trigramme'
|
||||
context_object_name = 'account'
|
||||
|
@ -2363,9 +2358,8 @@ ID_PREFIX_ART_LAST_WEEKS = "last_weeks_art"
|
|||
ID_PREFIX_ART_LAST_MONTHS = "last_months_art"
|
||||
|
||||
|
||||
# Un résumé de toutes les vues ArticleStatLast
|
||||
# NE REND PAS DE JSON
|
||||
class ArticleStatSalesList(SingleResumeStat):
|
||||
"""Manifest for sales stats of an article."""
|
||||
model = Article
|
||||
context_object_name = 'article'
|
||||
id_prefix = ID_PREFIX_ART_LAST
|
||||
|
@ -2379,10 +2373,7 @@ class ArticleStatSalesList(SingleResumeStat):
|
|||
|
||||
|
||||
class ArticleStatSales(ScaleMixin, JSONDetailView):
|
||||
"""
|
||||
Returns a JSON containing the consommation
|
||||
of an article at the diffent dates precised
|
||||
"""
|
||||
"""Datasets of sales of an article."""
|
||||
model = Article
|
||||
context_object_name = 'article'
|
||||
|
||||
|
|
Loading…
Reference in a new issue