diff --git a/core/templates/base.html b/core/templates/base.html index 139ac9151e59ddbbcdff08db28d5e607d9e1e48f..c3c791fa2e4ab5a0c55bb3fa76c12c8f97f1f6f7 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -40,7 +40,7 @@ </a> <div class="navbar-nav mr-auto"> - {% block navbar %}{% endblock navbar %} + {% block navbar %}Grady, Sir. Delbert Grady.{% endblock navbar %} </div> {% if user.is_authenticated %} diff --git a/core/templates/core/r/progress_card.html b/core/templates/core/r/progress_card.html index 5ad002c433c13c3b3bc5f96213221483e206e285..99b20f301e42d1a07610106083903d1accb09ecc 100644 --- a/core/templates/core/r/progress_card.html +++ b/core/templates/core/r/progress_card.html @@ -5,12 +5,18 @@ <thead> <th>Name</th> <th>Progress</th> + <th></th> </thead> <tbody> {% for submission_type in submission_type_list %} <tr> <td class="align-middle">{{ submission_type }}</td> - <td class="align-middle"><code>{{ submission_type.feedback_count }} / {{submission_type.submission_count}}</code></td> + <td class="align-middle" width="30%"> + <div class="progress"> + <div class="progress-bar" role="progressbar" style="width: {{submission_type.percentage}}%;"></div> + </div> + </td> + <td class="align-middle fit"><code>{{ submission_type.feedback_count }} / {{submission_type.submission_count}}</code></td> </tr> {% endfor %} </tbody> diff --git a/core/templates/core/r/student_submission_list.html b/core/templates/core/r/student_submission_list.html index 2b28a8d814eb8acb8d6be0c38aa7801ac6a7346d..59bea6014bdaabec8d182e335d77db81e34ed8be 100644 --- a/core/templates/core/r/student_submission_list.html +++ b/core/templates/core/r/student_submission_list.html @@ -24,7 +24,7 @@ <td class="align-middle fit"> <a href="{% url 'SubmissionViewReviewer' submission.slug %}" class="btn btn-outline-primary mb-1" name="edit" value="View">View submission</a></td> <td class="align-middle"> {{ submission.type }} </td> <td class="align-middle"> {{ submission.student }} </td> - <td class="align-middle"> + <td class="align-middle fit"> {% if submission.feedback %} <code> {{ submission.feedback.score }} / {{ submission.type.full_score }} </code> {% else %} diff --git a/core/templates/core/t/tutor_startpage.html b/core/templates/core/t/tutor_startpage.html index f69294223bf82f928fba1bb9bb6c08e7f048a0bc..c9c3277ad5f2ca06d345280e6b3e6cc24b5d240a 100644 --- a/core/templates/core/t/tutor_startpage.html +++ b/core/templates/core/t/tutor_startpage.html @@ -14,6 +14,7 @@ <h4 class="card-header">Overview</h4> <table class="table nomargin"> <thead> + <th></th> <th>Name</th> <th>Progress</th> <th></th> @@ -21,14 +22,23 @@ <tbody> {% for submission_type in submission_type_list %} <tr> - <td class="align-middle">{{ submission_type }}</td> - <td class="align-middle"><code>{{ submission_type.feedback_count }} / {{submission_type.submission_count}}</code></td> - <td class="align-middle"><a role="button" class="btn btn-secondary" href="{% url 'CreateFeedbackForType' submission_type.slug %}">Get</a></td> + <td class="align-middle"><a role="button" class="btn btn-secondary {% if submission_type.percentage == 100 %}disabled{% endif %}" href="{% url 'CreateFeedbackForType' submission_type.slug %}">Get</a></td> + <td class="align-middle fit">{{ submission_type }}</td> + <td class="align-middle" width="70%"> + <div class="progress"> + <div class="progress-bar" role="progressbar" style="width: {{submission_type.percentage}}%;"></div> + </div> + </td> + <td class="align-middle fit"><code>{{ submission_type.feedback_count }} / {{submission_type.submission_count}}</code></td> </tr> {% endfor %} + </tbody> + </table> + <table class="table nomargin"> + <tbody> <tr> - <td><strong>Your contribution:</strong></td> - <td colspan="2"><code>{% if feedback_list|length > 0 %} {{feedback_list|length}} {% else %} None. Sad. {% endif %}</code></td> + <td class="fit"><strong>Your contribution:</strong></td> + <td colspan="6"><code>{% if feedback_list|length > 0 %} {{feedback_list|length}} {% else %} None. Sad. {% endif %}</code></td> </tr> </tbody> </table> @@ -48,13 +58,13 @@ <th></th> </thead> <tbody> - {% for feedback in feedback_open_list %} - <tr> - <td class="align-middle"> {{ feedback.of_submission.type }} </td> - <td class="align-middle"> {{ feedback.of_tutor }} </td> - <td class="align-middle"><a class="btn btn-secondary" href="{% url 'FeedbackEdit' feedback.slug %}"> Assign </a></td> - </tr> - {% endfor %} + {% for feedback in feedback_open_list %} + <tr> + <td class="align-middle"> {{ feedback.of_submission.type }} </td> + <td class="align-middle"> {{ feedback.of_tutor }} </td> + <td class="align-middle"><a class="btn btn-secondary" href="{% url 'FeedbackEdit' feedback.slug %}"> Assign </a></td> + </tr> + {% endfor %} </tbody> </table> </div> @@ -81,7 +91,7 @@ {% for feedback in feedback_list %} <tr> <td> - {% include "core/component/feedback_badge.html" %} + {% include "core/component/feedback_badge.html" %} </td> <td> {{ feedback.of_submission.type }} </td> <td> <code> {{ feedback.score }} / {{feedback.of_submission.type.full_score}} </code> </td> @@ -106,14 +116,14 @@ <script> $(document).ready(function() { $('#list-id-tutoren').DataTable({ - "paging": false, - "info": false, - "searching": false, - "stateSave": true, - "order": [[ 0, 'desc' ], [ 3, 'desc' ]], - "columnDefs": [ - { "orderable": false, "targets": -1 }, - ] + "paging": false, + "info": false, + "searching": false, + "stateSave": true, + "order": [[ 0, 'desc' ], [ 3, 'desc' ]], + "columnDefs": [ + { "orderable": false, "targets": -1 }, + ] }); }); </script> diff --git a/core/views/user_startpages.py b/core/views/user_startpages.py index 1a0e4f4a2d273ca5aec3b971579466d172b54b8a..f6fd29f16b8398882e791c24200b08170bca4b7b 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, Case, When, IntegerField, Value +from django.db.models import Count, Q, F, Case, When, IntegerField, Value from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse @@ -46,6 +46,8 @@ def get_annotated_feedback_count(): ) ).annotate( submission_count=Count('submissions') + ).annotate( + percentage=(F('feedback_count') * 100 / F('submission_count')) ).all().order_by('name') def get_annotated_tutor_list(): @@ -54,8 +56,9 @@ def get_annotated_tutor_list(): @group_required('Tutors') def tutor_view(request): + submission_type = get_annotated_feedback_count() context = { - 'submission_type_list': get_annotated_feedback_count(), + 'submission_type_list': submission_type, 'feedback_list': Feedback.objects.filter(of_tutor=request.user), 'feedback_open_list': Feedback.objects.filter(Q(status=Feedback.OPEN) & ~Q(of_tutor=request.user)), }