Limite de l'historique chargé sur K-Psul

This commit is contained in:
Aurélien Delobelle 2016-09-05 14:39:31 +02:00
parent 16fe7eb994
commit 6c54d582ed
2 changed files with 5 additions and 0 deletions

View file

@ -959,6 +959,7 @@ $(document).ready(function() {
function getHistory() {
var data = {
from: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'),
limit: 100,
};
$.ajax({
dataType: "json",

View file

@ -1248,6 +1248,7 @@ def history_json(request):
# Récupération des paramètres
from_date = request.POST.get('from', None)
to_date = request.POST.get('to', None)
limit = request.POST.get('limit', None);
checkouts = request.POST.getlist('checkouts[]', None)
accounts = request.POST.getlist('accounts[]', None)
@ -1274,6 +1275,9 @@ def history_json(request):
# Un non-membre de l'équipe n'a que accès à son historique
if not request.user.has_perm('kfet.is_team'):
opegroups = opegroups.filter(on_acc=request.user.profile.account_kfet)
if limit:
opegroups = opegroups[:limit]
# Construction de la réponse
opegroups_list = []