Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Table for Marks Breakdown in view_team #76

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions TWT/apps/timathon/views/view_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
32 changes: 31 additions & 1 deletion TWT/static/css/timathonTeam.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@




.team-container {
color:#F9F9FA;
font-family:Roboto;
Expand Down Expand Up @@ -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;
Expand All @@ -130,4 +161,3 @@ padding: 10px;
}



40 changes: 40 additions & 0 deletions TWT/templates/timathon/view_team.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,46 @@ <h6 style="margin-left: 2px">{{ submission.description }}</h6>

</div>
{% endif %}

{% if not challenge.voting_status and votes and user in team.members.all %}
<h2 align="center" style="color:white">Marks Breakdown</h2>
<table>
<tr>
<th>C1</th>
<th>C2</th>
<th>C3</th>
<th>C4</th>
<th>Notes</th>
</tr>
{% for vote in votes %}
<tr>
<td>{{ vote.c1 }}</td>
<td>{{ vote.c2 }}</td>
<td>{{ vote.c3 }}</td>
<td>{{ vote.c4 }}</td>
<td>{{ vote.notes }}</td>
</tr>
{% endfor %}
</table>
<table>
<tr>
<th>Avg C1</th>
<th>Avg C2</th>
<th>Avg C3</th>
<th>Avg C4</th>
<th>Total Score</th>
</tr>
<br>
<tr>
<td>{{ avg_1 }}</td>
<td>{{ avg_2 }}</td>
<td>{{ avg_3 }}</td>
<td>{{ avg_4 }}</td>
<th>{{ total_score }}</th>
</tr>
</table>
{% endif %}

<script type="text/javascript">
function Copy()
{
Expand Down