|
|
|
|
@ -6,7 +6,7 @@ from django.utils.html import escape |
|
|
|
|
from django.urls import reverse, path |
|
|
|
|
from django.utils.safestring import mark_safe |
|
|
|
|
from django.shortcuts import render |
|
|
|
|
from django.db.models import Avg |
|
|
|
|
from django.db.models import Avg, Count |
|
|
|
|
from datetime import timedelta, datetime |
|
|
|
|
|
|
|
|
|
from biz.models import Prospect, ProspectGroup |
|
|
|
|
@ -18,7 +18,6 @@ from .filters import TeamScoreTournamentListFilter, MatchTournamentListFilter, S |
|
|
|
|
from sync.admin import SyncedObjectAdmin |
|
|
|
|
import logging |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
class CustomUserAdmin(UserAdmin): |
|
|
|
|
@ -241,6 +240,10 @@ class TournamentAdmin(SyncedObjectAdmin): |
|
|
|
|
avg_teams=Avg('tournament__team_count') |
|
|
|
|
)['avg_teams'] or 0 |
|
|
|
|
|
|
|
|
|
email_count = PlayerRegistration.objects.aggregate( |
|
|
|
|
total=Count('email', distinct=True) |
|
|
|
|
)['total'] |
|
|
|
|
|
|
|
|
|
avg_entry_fee = Tournament.objects.exclude(is_deleted=True).aggregate( |
|
|
|
|
avg_fee=Avg('entry_fee') |
|
|
|
|
)['avg_fee'] or 0 |
|
|
|
|
@ -325,6 +328,7 @@ class TournamentAdmin(SyncedObjectAdmin): |
|
|
|
|
'tournaments_with_payment': tournaments_with_payment, |
|
|
|
|
'avg_teams_per_tournament': round(avg_teams_per_tournament, 1), |
|
|
|
|
'avg_entry_fee': round(avg_entry_fee, 2), |
|
|
|
|
'email_count': email_count, |
|
|
|
|
|
|
|
|
|
# User statistics |
|
|
|
|
'total_users': total_users, |
|
|
|
|
|