diff --git a/TWT/apps/timathon/views/view_team.py b/TWT/apps/timathon/views/view_team.py index f332849..da9e66f 100644 --- a/TWT/apps/timathon/views/view_team.py +++ b/TWT/apps/timathon/views/view_team.py @@ -6,7 +6,7 @@ from django.views import View from random import randint from TWT.apps.challenges.models import Challenge -from TWT.apps.timathon.models import Team +from TWT.apps.timathon.models import Team, Vote from TWT.context import get_discord_context from ..models import Submission @@ -45,9 +45,20 @@ def get_context(self, request: WSGIRequest, team_ID) -> dict: context["challenge"] = team.challenge if team.submitted: try: - context["submission"] = Submission.objects.get( + team_submission = Submission.objects.get( team=team, challenge=team.challenge ) + context["submission"] = team_submission + + votes = Vote.objects.filter(submission=team_submission) + + context['avg_1'] = sum(map(lambda x: x.c1, votes)) / len(votes) + context['avg_2'] = sum(map(lambda x: x.c2, votes)) / len(votes) + context['avg_3'] = sum(map(lambda x: x.c3, votes)) / len(votes) + context['avg_4'] = sum(map(lambda x: x.c4, votes)) / len(votes) + + context['total_score'] = context['avg_1'] + context['avg_2'] + context['avg_3'] + context['avg_4'] + context['votes'] = votes except: pass print(context["challenge"].submissions_status) diff --git a/TWT/static/css/timathonTeam.css b/TWT/static/css/timathonTeam.css index 760b22b..8f632bf 100644 --- a/TWT/static/css/timathonTeam.css +++ b/TWT/static/css/timathonTeam.css @@ -1,5 +1,7 @@ + + .team-container { color:#F9F9FA; font-family:Roboto; @@ -114,6 +116,35 @@ padding: 10px; height:auto; } +table{ + color: white; + margin-left: auto; + margin-right: auto; + border-radius: .5rem; + width: 70vw; +} + +tr{ + border: 2px solid #FF7746; + +} + +th{ + border: 4px solid #FF7746; + font-size: 1.5rem; + text-align: center; + padding: .5rem; +} + +td{ + border: 4px solid #FF7746; + font-size: 1.1rem; + text-align: center; + padding: .5rem; + word-wrap: break-word; +} + + @media screen and (max-width: 768px){ .members-card{ flex: 1; @@ -130,4 +161,3 @@ padding: 10px; } - diff --git a/TWT/templates/timathon/view_team.html b/TWT/templates/timathon/view_team.html index 9a28b47..b5aefca 100644 --- a/TWT/templates/timathon/view_team.html +++ b/TWT/templates/timathon/view_team.html @@ -59,6 +59,46 @@
{{ submission.description }}
{% endif %} + + {% if not challenge.voting_status and votes and user in team.members.all %} +

Marks Breakdown

+ + + + + + + + + {% for vote in votes %} + + + + + + + + {% endfor %} +
C1C2C3C4Notes
{{ vote.c1 }}{{ vote.c2 }}{{ vote.c3 }}{{ vote.c4 }}{{ vote.notes }}
+ + + + + + + + +
+ + + + + + + +
Avg C1Avg C2Avg C3Avg C4Total Score
{{ avg_1 }}{{ avg_2 }}{{ avg_3 }}{{ avg_4 }}{{ total_score }}
+ {% endif %} +