Skip to content

Commit

Permalink
Merge pull request #46 from borgia-app/fix_rechargings_list
Browse files Browse the repository at this point in the history
fix rechargings list & add indication limit
  • Loading branch information
AlexandrePalo authored May 8, 2018
2 parents 053793d + 3c269a4 commit 5e24560
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions finances/templates/finances/recharging_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<div class="col-sm-10 col-sm-offset-2">
<button type="submit" class="btn btn-primary">Recherche</button>
<a class="btn btn-warning" href="">Remise à zéro</a>
<span style="opacity: 0.54; margin-left: 5px;">Les 1000 premiers résultats sont affichés</span>
</div>
</div>
</form>
Expand Down
2 changes: 2 additions & 0 deletions finances/templates/finances/sharedevent_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
<th>Participants / Parts</th>
<th>Status</th>
<th>Remarque</th>
{% if user == sharedevent.manager %}
<th>Gestion</th>
{% endif %}
</tr>
{% for sharedevent in shared_events %}
<tr>
Expand Down
12 changes: 7 additions & 5 deletions finances/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def get_context_data(self, **kwargs):
context['recharging_list'] = Recharging.objects.all().order_by('-datetime')

context['recharging_list'] = self.form_query(
context['recharging_list'])[:100]
context['recharging_list'])[:1000]

context['info'] = self.info(context['recharging_list'])
return context
Expand All @@ -515,7 +515,8 @@ def info(self, query):
info = {
'cash': {
'total': 0,
'nb': 0
'nb': 0,
'ids': Cash.objects.none()
},
'cheque': {
'total': 0,
Expand All @@ -542,18 +543,19 @@ def info(self, query):
if r.payment_solution.get_type() == 'cash':
info['cash']['total'] += r.payment_solution.amount
info['cash']['nb'] += 1
info['cash']['ids'] |= Cash.objects.filter(pk=r.payment_solution.cash.pk)
if r.payment_solution.get_type() == 'cheque':
info['cheque']['total'] += r.payment_solution.amount
info['cheque']['nb'] += 1
info['cheque']['ids'] |= [r.payment_solution.cheque]
info['cheque']['ids'] |= Cheque.objects.filter(pk=r.payment_solution.cheque.pk)
if r.payment_solution.get_type() == 'lydiafacetoface':
info['lydia_face2face']['total'] += r.payment_solution.amount
info['lydia_face2face']['nb'] += 1
info['lydia_face2face']['ids'] |= [r.payment_solution.lydiafacetoface]
info['lydia_face2face']['ids'] |= LydiaFaceToFace.objects.filter(pk=r.payment_solution.lydiafacetoface.pk)
if r.payment_solution.get_type() == 'lydiaonline':
info['lydia_online']['total'] += r.payment_solution.amount
info['lydia_online']['nb'] += 1
info['lydia_online']['ids'] |= [r.payment_solution.lydiaonline]
info['lydia_online']['ids'] |= LydiaOnline.objects.filter(pk=r.payment_solution.lydiaonline.pk)
info['total']['total'] += r.payment_solution.amount
info['total']['nb'] += 1
return info
Expand Down

0 comments on commit 5e24560

Please sign in to comment.