Private
Public Access
1
0

improved order of sessions / coach view

This commit is contained in:
Sander Roosendaal
2018-03-24 14:44:49 +01:00
parent dfbeaae1fa
commit a9345a66b5
3 changed files with 19 additions and 13 deletions

View File

@@ -369,13 +369,13 @@ def get_sessions_manager(m,teamid=0,startdate=date.today(),
manager=m,
startdate__lte=enddate,
enddate__gte=startdate,
).order_by("startdate","preferreddate","enddate")
).order_by("preferreddate","startdate","enddate")
else:
sps = PlannedSession.objects.filter(
manager=m,
startdate__lte=enddate,
enddate__gte=startdate,
).order_by("startdate","preferreddate","enddate")
).order_by("preferreddate","startdate","enddate")
return sps

View File

@@ -35,15 +35,15 @@
Last Week
</a>
<a class="button gray small alpha"
href="/rowers/sessions/coach/lastmonth/">
href="/rowers/sessions/coach/lastmonth">
Last Month
</a>
<a class="button gray small alpha"
href="/rowers/sessions/coach/nextweek/">
href="/rowers/sessions/coach/nextweek">
Next Week
</a>
<a class="button gray small alpha"
href="/rowers/sessions/coach/nextmonth/">
href="/rowers/sessions/coach/nextmonth">
Next Month
</a>
</div>
@@ -81,6 +81,7 @@
<tr>
<th>On or after</th>
<th>On or before</th>
<th>Preferred date</th>
<th>Name</th>
{% for r in rowers %}
<th class="rotate"><div><span>
@@ -90,7 +91,7 @@
</tr>
</thead>
<tbody>
{% for key, thedict in statusdict.items %}
{% for thedict in statusdict %}
<tr>
<td>
{{ thedict|lookup:'startdate'|date:"Y-m-d" }}
@@ -99,7 +100,10 @@
{{ thedict|lookup:'enddate'|date:"Y-m-d" }}
</td>
<td>
<a href="/rowers/sessions/{{ key }}">
{{ thedict|lookup:'preferreddate'|date:"Y-m-d" }}
</td>
<td>
<a href="/rowers/sessions/{{ thedict|lookup:"id" }}">
{% if thedict|lookup:'name' %}
{{ thedict|lookup:'name' }}
{% else %}
@@ -111,18 +115,18 @@
<td>
{% if thedict|lookup:'results'|lookup:r.id == 'completed' %}
<a class="green dot"
href="{% url 'plannedsession_view' id=key rowerid=r.id %}">&nbsp;</a>
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}">&nbsp;</a>
{% elif thedict|lookup:'results'|lookup:r.id == 'partial' %}
<a class="orange dot"
href="{% url 'plannedsession_view' id=key rowerid=r.id %}">&nbsp;</a>
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}">&nbsp;</a>
{% elif thedict|lookup:'results'|lookup:r.id == 'not done' %}
<a class="white dot"
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ key }}">&nbsp;</a>
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}">&nbsp;</a>
{% elif thedict|lookup:'results'|lookup:r.id == 'not assigned' %}
&nbsp;
{% else %}
<a class="red dot"
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ key }}">&nbsp;</a>
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}">&nbsp;</a>
{% endif %}
</td>
{% endfor %}

View File

@@ -12554,7 +12554,7 @@ def plannedsessions_coach_view(request,timeperiod='thisweek',
rowers = list(set(rowers))
statusdict = {}
statusdict = []
for ps in sps:
rowerstatus = {}
@@ -12562,12 +12562,14 @@ def plannedsessions_coach_view(request,timeperiod='thisweek',
ratio, status,completiondate = is_session_complete(r,ps)
rowerstatus[r.id] = status
sessiondict = {
'id': ps.id,
'results':rowerstatus,
'name': ps.name,
'startdate': ps.startdate,
'preferreddate': ps.preferreddate,
'enddate': ps.enddate,
}
statusdict[ps.id] = sessiondict
statusdict.append(sessiondict)
unmatchedworkouts = []
for r in rowers: