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, manager=m,
startdate__lte=enddate, startdate__lte=enddate,
enddate__gte=startdate, enddate__gte=startdate,
).order_by("startdate","preferreddate","enddate") ).order_by("preferreddate","startdate","enddate")
else: else:
sps = PlannedSession.objects.filter( sps = PlannedSession.objects.filter(
manager=m, manager=m,
startdate__lte=enddate, startdate__lte=enddate,
enddate__gte=startdate, enddate__gte=startdate,
).order_by("startdate","preferreddate","enddate") ).order_by("preferreddate","startdate","enddate")
return sps return sps

View File

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

View File

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