Skip to content
Snippets Groups Projects
Commit 752e2ee0 authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

minor fixes and only accepted feedback is counted

parent ad3af33f
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,7 @@
"paging": false,
"info": false,
"searching": false,
"stateSave": true,
"order": [[ 0, 'desc' ], [ 2, 'desc' ]],
"columnDefs": [
{ "orderable": false, "targets": -1 },
......
......@@ -109,6 +109,7 @@
"paging": false,
"info": false,
"searching": false,
"stateSave": true,
"order": [[ 0, 'desc' ], [ 3, 'desc' ]],
"columnDefs": [
{ "orderable": false, "targets": -1 },
......
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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment