Loading stats/admin.py +12 −0 Changes for stats/admin.py: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ from elections.models import Election from vote.models import Participation from voters.models import Voter, Group import re def live_results(request, election_id): context = admin.site.each_context(request) Loading Loading @@ -46,6 +48,16 @@ def statistics(request, election_id): 'percentage': round((voted / total * 100), 2) if total > 0 else 0 }) def sort_key(item): name = item.get('class_name') or "" match = re.search(r'd+', name) num = int(match.group()) if match else 0 return (num, name.lower()) stats_by_class.sort(key=sort_key) remote_count = Participation.objects.filter(election=election, is_remote=True).count() stationary_count = total_participated - remote_count; Loading Loading
stats/admin.py +12 −0 Changes for stats/admin.py: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ from elections.models import Election from vote.models import Participation from voters.models import Voter, Group import re def live_results(request, election_id): context = admin.site.each_context(request) Loading Loading @@ -46,6 +48,16 @@ def statistics(request, election_id): 'percentage': round((voted / total * 100), 2) if total > 0 else 0 }) def sort_key(item): name = item.get('class_name') or "" match = re.search(r'd+', name) num = int(match.group()) if match else 0 return (num, name.lower()) stats_by_class.sort(key=sort_key) remote_count = Participation.objects.filter(election=election, is_remote=True).count() stationary_count = total_participated - remote_count; Loading