Private
Public Access
1
0
This commit is contained in:
2023-09-20 22:34:41 +02:00
parent f03a62da9a
commit e994fd1bf3
2 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import sys
import os
from datetime import datetime
from django.core.management.base import BaseCommand
from boatmovers.models import Athlete, Crew, Race, Result
import pandas as pd
class Command(BaseCommand):
def handle(self, *args, **options):
athletes = Athlete.objects.filter(trueskill_exposed__gt=0,
dummy=False).order_by('-trueskill_exposed','-birth_year','last_name','first_name')
df = pd.DataFrame(athletes.values())
filename = "media/boatmovers_"+datetime.now().strftime("%Y-%m-%d")+".csv"
df.to_csv(filename)

View File

@@ -0,0 +1,81 @@
{% extends "boatmovers_base.html" %}
{% block main %}
<form action="" method="post">{% csrf_token %}
{{ form.as_table }}
<input type="submit" value="Compare" />
</form>
<table width="100%" class="listtable shortpadded">
<thead>
<tr>
<th>
#
</th>
<th>
Name
</th>
<th>
Club
</th>
<th>
Gender
</th>
<th>
Rank 1
</th>
<th>
Rank 2
</th>
<th>
Positions Climbed
</th>
<th>
Score 1
</th>
<th>
Score 2
</th>
<th>
Score Increase
</th>
</tr>
</thead>
<tbody>
{% for index, row in df.iterrows %}
<tr>
<td>
{{ forloop.counter }}
</td>
<td>
{{ row.Name }}
</td>
<td>
{{ row.club }}
</td>
<td>
{{ row.gender }}
</td>
<td>
{{ row.Rank1 }}
</td>
<td>
{{ row.Rank2 }}
</td>
<td>
{{ row.PositionsClimbed }}
</td>
<td>
{{ row.Score1|floatformat:2 }}
</td>
<td>
{{ row.Score2|floatformat:2 }}
</td>
<td>
{{ row.ScoreIncrease|floatformat:2 }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}