diff --git a/hypha/apply/funds/tables.py b/hypha/apply/funds/tables.py index edf1b6c214df69741c79387ff405ea3c2e869f7c..c65ac1c4b34d175fb8f1f4173295a787df01415b 100644 --- a/hypha/apply/funds/tables.py +++ b/hypha/apply/funds/tables.py @@ -409,7 +409,6 @@ class LeaderboardFilter(filters.FilterSet): class LeaderboardTable(tables.Table): full_name = tables.Column(verbose_name="Reviewer") - most_recent = tables.Column(orderable=False) class Meta: fields = [ @@ -418,21 +417,6 @@ class LeaderboardTable(tables.Table): 'ninety_days', 'this_year', 'last_year', - 'most_recent', ] model = User order_by = ('-total',) - - def render_most_recent(self, record): - review = (Review.objects.filter(author__reviewer=record) - .order_by('-created_at') - .first()) - - if review is None: - return None - - return format_html( - '<a href="{}">{}</a>', - review.revision.submission.get_absolute_url(), - review.revision.submission.title, - ) diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 7c232b945d72b0ccf339eb890e919394c13afef2..fd393579c7d4a35cf0cc0c3d7d0733bf0a66d68b 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -7,7 +7,7 @@ from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.mixins import UserPassesTestMixin from django.contrib.humanize.templatetags.humanize import intcomma from django.core.exceptions import PermissionDenied -from django.db.models import Count, F, OuterRef, Q, Subquery +from django.db.models import Count, F, Q from django.http import FileResponse, Http404, HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.urls import reverse_lazy @@ -1197,13 +1197,11 @@ class ReviewLeaderboard(UserPassesTestMixin, SingleTableMixin, FilterView): ninety_days_ago = timezone.now() - timedelta(days=90) this_year = timezone.now().year last_year = timezone.now().year - 1 - # latest_reviews = Review.objects.filter(author__reviewer_id=OuterRef('pk')).order_by('-created_at') return super().get_table_data().filter(submissions_reviewer__isnull=False).annotate( total=Count('assignedreviewers__review'), ninety_days=Count('assignedreviewers__review', filter=Q(assignedreviewers__review__created_at__date__gte=ninety_days_ago)), this_year=Count('assignedreviewers__review', filter=Q(assignedreviewers__review__created_at__year=this_year)), last_year=Count('assignedreviewers__review', filter=Q(assignedreviewers__review__created_at__year=last_year)), - # most_recent=Subquery(latest_reviews.values('id')[:1]) ) def test_func(self):