From f4cb1e2e83c037d506edc20f4519a5a4a41dd6b4 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 15 May 2017 14:17:58 -0300 Subject: [PATCH] Add opesonly option --- kfet/static/kfet/js/history.js | 3 +++ kfet/static/kfet/js/kpsul.js | 4 +++- kfet/views.py | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js index faf1e0e2..d3bd6308 100644 --- a/kfet/static/kfet/js/history.js +++ b/kfet/static/kfet/js/history.js @@ -113,6 +113,9 @@ class KHistory { if (options.transfersonly && opegroup.constructor.verbose_name == 'opegroup') return false; + if (options.opesonly && opegroup.constructor.verbose_name == 'transfergroup') + return false; + if (options.accounts && options.accounts.length && options.accounts.indexOf(opegroup.account_id) < 0) return false; diff --git a/kfet/static/kfet/js/kpsul.js b/kfet/static/kfet/js/kpsul.js index 64a7a64e..5645263d 100644 --- a/kfet/static/kfet/js/kpsul.js +++ b/kfet/static/kfet/js/kpsul.js @@ -12,7 +12,9 @@ class KPsulManager { this.account_manager = new AccountManager(this); this.checkout_manager = new CheckoutManager(this); this.article_manager = new ArticleManager(this); - this.history = new KHistory(); + this.history = new KHistory({ + api_options: {'opesonly': true}, + }); this._init_events(); } diff --git a/kfet/views.py b/kfet/views.py index e0fc6e35..acd9f0a2 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -1468,6 +1468,7 @@ def history_json(request): checkouts = request.GET.getlist('checkouts[]', None) accounts = request.GET.getlist('accounts[]', None) transfers_only = request.GET.get('transfersonly', None) + opes_only = request.GET.get('opesonly', None) # Un non-membre de l'équipe n'a que accès à son historique if not request.user.has_perm('kfet.is_team'): @@ -1525,6 +1526,8 @@ def history_json(request): transfergroups = TransferGroup.objects.none() if transfers_only: opegroups = OperationGroup.objects.none() + if opes_only: + transfergroups = TransferGroup.objects.none() if accounts: opegroups = opegroups.filter(on_acc_id__in=accounts)