Fewer db requests on bda tirage.

bda.algorithm
- use iterator to find max_groups, instead of a db request

bda.views.do_tirage
- select_related() are now focused on some relationships (they were
  taking useless relationships)
- bda-revente filling takes 1 request (each save and add was issuing
  1 request)
This commit is contained in:
Aurélien Delobelle 2017-04-07 16:22:10 +02:00
parent 3e0bd2e758
commit 9f307c1bd0
2 changed files with 17 additions and 9 deletions

View file

@ -22,8 +22,7 @@ class Algorithm(object):
show.requests
- on crée des tables de demandes pour chaque personne, afin de
pouvoir modifier les rankings"""
self.max_group = \
2 * choices.aggregate(Max('priority'))['priority__max']
self.max_group = 2*max(choice.priority for choice in choices)
self.shows = []
showdict = {}
for show in shows: