Merge branch 'release/v6.34'
This commit is contained in:
@@ -72,6 +72,7 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
|||||||
workout = Workout.objects.get(id=workoutid[0])
|
workout = Workout.objects.get(id=workoutid[0])
|
||||||
uploads.do_sync(workout, uploadoptions)
|
uploads.do_sync(workout, uploadoptions)
|
||||||
uploads.make_private(workout, uploadoptions)
|
uploads.make_private(workout, uploadoptions)
|
||||||
|
uploads.set_workouttype(workout, uploadoptions)
|
||||||
if 'make_plot' in uploadoptions:
|
if 'make_plot' in uploadoptions:
|
||||||
plottype = uploadoptions['plottype']
|
plottype = uploadoptions['plottype']
|
||||||
workoutcsvfilename = workout.csvfilename[6:-4]
|
workoutcsvfilename = workout.csvfilename[6:-4]
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -386,7 +386,7 @@ def get_sessions(r,startdate=date.today(),
|
|||||||
rower__in=[r],
|
rower__in=[r],
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
@@ -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 %}"> </a>
|
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}"> </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 %}"> </a>
|
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}"> </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 }}"> </a>
|
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}"> </a>
|
||||||
{% elif thedict|lookup:'results'|lookup:r.id == 'not assigned' %}
|
{% elif thedict|lookup:'results'|lookup:r.id == 'not assigned' %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="red dot"
|
<a class="red dot"
|
||||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ key }}"> </a>
|
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}"> </a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -362,7 +362,11 @@ class EmailTests(TestCase):
|
|||||||
from_header = u.email,
|
from_header = u.email,
|
||||||
subject = filename,
|
subject = filename,
|
||||||
body="""
|
body="""
|
||||||
chart time
|
---
|
||||||
|
chart: time
|
||||||
|
workouttype: water
|
||||||
|
boattype: 4x
|
||||||
|
...
|
||||||
""")
|
""")
|
||||||
m.save()
|
m.save()
|
||||||
a2 = 'media/mailbox_attachments/'+filename
|
a2 = 'media/mailbox_attachments/'+filename
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ queue = django_rq.get_queue('default')
|
|||||||
queuelow = django_rq.get_queue('low')
|
queuelow = django_rq.get_queue('low')
|
||||||
queuehigh = django_rq.get_queue('low')
|
queuehigh = django_rq.get_queue('low')
|
||||||
|
|
||||||
|
from types import workouttypes,boattypes
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
except:
|
except:
|
||||||
@@ -96,6 +98,29 @@ def matchsync(line):
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
def gettypeoptions_body2(uploadoptions,body):
|
||||||
|
tester = re.compile('^(workout)')
|
||||||
|
testerb = re.compile('^(boat)')
|
||||||
|
for line in body.splitlines():
|
||||||
|
if tester.match(line.lower()):
|
||||||
|
for typ,verb in workouttypes:
|
||||||
|
str1 = '^(workout)(.*)({a})'.format(
|
||||||
|
a = typ
|
||||||
|
)
|
||||||
|
testert = re.compile(str1)
|
||||||
|
if testert.match(line.lower()):
|
||||||
|
uploadoptions['workouttype'] = typ
|
||||||
|
if testerb.match(line.lower()):
|
||||||
|
for typ,verb in boattypes:
|
||||||
|
str1 = '^(boat)(.*)({a})'.format(
|
||||||
|
a = typ
|
||||||
|
)
|
||||||
|
testert = re.compile(str1)
|
||||||
|
if testert.match(line.lower()):
|
||||||
|
uploadoptions['boattype'] = typ
|
||||||
|
|
||||||
|
return uploadoptions
|
||||||
|
|
||||||
def getprivateoptions_body2(uploadoptions,body):
|
def getprivateoptions_body2(uploadoptions,body):
|
||||||
tester = re.compile('^(priva)')
|
tester = re.compile('^(priva)')
|
||||||
for line in body.splitlines():
|
for line in body.splitlines():
|
||||||
@@ -181,6 +206,32 @@ def getplotoptions(uploadoptions,value):
|
|||||||
|
|
||||||
return uploadoptions
|
return uploadoptions
|
||||||
|
|
||||||
|
|
||||||
|
def gettype(uploadoptions,value,key):
|
||||||
|
workouttype = 'rower'
|
||||||
|
for type,verb in workouttypes:
|
||||||
|
if value == type:
|
||||||
|
workouttype = type
|
||||||
|
if value == verb:
|
||||||
|
workouttype = type
|
||||||
|
|
||||||
|
uploadoptions[key] = workouttype
|
||||||
|
|
||||||
|
return uploadoptions
|
||||||
|
|
||||||
|
def getboattype(uploadoptions,value,key):
|
||||||
|
boattype = '1x'
|
||||||
|
for type,verb in boattypes:
|
||||||
|
if value == type:
|
||||||
|
boattype = type
|
||||||
|
if value == verb:
|
||||||
|
boattype = type
|
||||||
|
|
||||||
|
uploadoptions[key] = boattype
|
||||||
|
|
||||||
|
return uploadoptions
|
||||||
|
|
||||||
|
|
||||||
def getboolean(uploadoptions,value,key):
|
def getboolean(uploadoptions,value,key):
|
||||||
b = True
|
b = True
|
||||||
if not value:
|
if not value:
|
||||||
@@ -208,6 +259,10 @@ def upload_options(body):
|
|||||||
uploadoptions = getplotoptions(uploadoptions,value)
|
uploadoptions = getplotoptions(uploadoptions,value)
|
||||||
if 'priva' in lowkey:
|
if 'priva' in lowkey:
|
||||||
uploadoptions = getboolean(uploadoptions,value,'makeprivate')
|
uploadoptions = getboolean(uploadoptions,value,'makeprivate')
|
||||||
|
if 'workout' in lowkey:
|
||||||
|
uploadoptions = gettype(uploadoptions,value,'workouttype')
|
||||||
|
if 'boat' in lowkey:
|
||||||
|
uploadoptions = getboattype(uploadoptions,value,'boattype')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
#pass
|
#pass
|
||||||
raise yaml.YAMLError
|
raise yaml.YAMLError
|
||||||
@@ -216,6 +271,7 @@ def upload_options(body):
|
|||||||
uploadoptions = getplotoptions_body2(uploadoptions,body)
|
uploadoptions = getplotoptions_body2(uploadoptions,body)
|
||||||
uploadoptions = getsyncoptions_body2(uploadoptions,body)
|
uploadoptions = getsyncoptions_body2(uploadoptions,body)
|
||||||
uploadoptions = getprivateoptions_body2(uploadoptions,body)
|
uploadoptions = getprivateoptions_body2(uploadoptions,body)
|
||||||
|
typeoptions = gettypeoptions_body2(uploadoptions,body)
|
||||||
except IOError:
|
except IOError:
|
||||||
pm = exc.problem_mark
|
pm = exc.problem_mark
|
||||||
strpm = str(pm)
|
strpm = str(pm)
|
||||||
@@ -296,6 +352,20 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
|||||||
import c2stuff,stravastuff,sporttracksstuff,runkeeperstuff
|
import c2stuff,stravastuff,sporttracksstuff,runkeeperstuff
|
||||||
import underarmourstuff,tpstuff
|
import underarmourstuff,tpstuff
|
||||||
|
|
||||||
|
def set_workouttype(w,options):
|
||||||
|
try:
|
||||||
|
w.workouttype = options['workouttype']
|
||||||
|
w.save()
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
w.boattype = options['boattype']
|
||||||
|
w.save()
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
def make_private(w,options):
|
def make_private(w,options):
|
||||||
if 'makeprivate' in options and options['makeprivate']:
|
if 'makeprivate' in options and options['makeprivate']:
|
||||||
w.privacy = 'hidden'
|
w.privacy = 'hidden'
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user