diff --git a/core/templates/core/reviewer_startpage.html b/core/templates/core/reviewer_startpage.html index efcbaa9eaf864956eb68b8bc79acd3b8da3c13c2..c6dd512d7a31ad9c3e63ea688a04c31d43ca1462 100644 --- a/core/templates/core/reviewer_startpage.html +++ b/core/templates/core/reviewer_startpage.html @@ -111,6 +111,7 @@ "paging": false, "info": false, "searching": false, + "stateSave": true, "order": [[ 0, 'desc' ], [ 2, 'desc' ]], "columnDefs": [ { "orderable": false, "targets": -1 }, diff --git a/core/templates/core/tutor_startpage.html b/core/templates/core/tutor_startpage.html index a2723f467b2f46a923ee126d11ed0cd5a557ac39..0347a72718b006d04e1b22f53d8de44c2e95fe9e 100644 --- a/core/templates/core/tutor_startpage.html +++ b/core/templates/core/tutor_startpage.html @@ -109,6 +109,7 @@ "paging": false, "info": false, "searching": false, + "stateSave": true, "order": [[ 0, 'desc' ], [ 3, 'desc' ]], "columnDefs": [ { "orderable": false, "targets": -1 }, diff --git a/core/views/user_startpages.py b/core/views/user_startpages.py index ab958d34c4450fbca0f81cda2bd04887a16b8fa1..51506a377cae8308408e8ca92fd3843ce9b027c5 100644 --- a/core/views/user_startpages.py +++ b/core/views/user_startpages.py @@ -1,6 +1,6 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User -from django.db.models import Count, Q +from django.db.models import Count, Q, Case, When, IntegerField, Value from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse @@ -36,10 +36,17 @@ def get_annotated_feedback_count(): Returns: annotated queryset """ - return SubmissionType.objects.annotate( # to display only manual - feedback_count=Count('submissions__feedback')).annotate( - submission_count=Count('submissions') - ).all().order_by('name') + return SubmissionType.objects\ + .annotate( # to display only manual + feedback_count=Count( + Case( + When(Q(submissions__feedback__isnull=False) & Q(submissions__feedback__status=Feedback.ACCEPTED), + then=Value(1)), output_field=IntegerField(), + ) + ) + ).annotate( + submission_count=Count('submissions') + ).all().order_by('name') @group_required('Tutors') def tutor_view(request):