Merge branch 'release/v20.7.4'
This commit is contained in:
@@ -4158,6 +4158,7 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
|
|
||||||
class CourseTestResult(models.Model):
|
class CourseTestResult(models.Model):
|
||||||
userid = models.IntegerField(default=0)
|
userid = models.IntegerField(default=0)
|
||||||
|
courseid = models.IntegerField(default=0)
|
||||||
workoutid = models.IntegerField(null=True)
|
workoutid = models.IntegerField(null=True)
|
||||||
plannedsession = models.ForeignKey(
|
plannedsession = models.ForeignKey(
|
||||||
PlannedSession, on_delete=models.CASCADE)
|
PlannedSession, on_delete=models.CASCADE)
|
||||||
@@ -4167,6 +4168,13 @@ class CourseTestResult(models.Model):
|
|||||||
startsecond = models.FloatField(default=0)
|
startsecond = models.FloatField(default=0)
|
||||||
endsecond = models.FloatField(default=0)
|
endsecond = models.FloatField(default=0)
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if self.userid == 0:
|
||||||
|
w = Workout.objects.get(id=self.workoutid)
|
||||||
|
self.userid = w.user.id
|
||||||
|
|
||||||
|
super(CourseTestResult, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class IndoorVirtualRaceResultForm(ModelForm):
|
class IndoorVirtualRaceResultForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -1149,9 +1149,11 @@ def handle_check_race_course(self,
|
|||||||
record.duration = totaltime_sec_to_string(coursetimeseconds)
|
record.duration = totaltime_sec_to_string(coursetimeseconds)
|
||||||
record.distance = int(coursemeters)
|
record.distance = int(coursemeters)
|
||||||
record.workoutid = workoutid
|
record.workoutid = workoutid
|
||||||
|
record.courseid = courseid
|
||||||
record.startsecond = startsecond
|
record.startsecond = startsecond
|
||||||
record.endsecond = endsecond
|
record.endsecond = endsecond
|
||||||
record.points = points
|
record.points = points
|
||||||
|
record.coursecompleted = 1
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
if summary: # pragma: no cover
|
if summary: # pragma: no cover
|
||||||
@@ -1178,7 +1180,6 @@ def handle_check_race_course(self,
|
|||||||
workout.summary = summary
|
workout.summary = summary
|
||||||
workout.save()
|
workout.save()
|
||||||
|
|
||||||
|
|
||||||
if successemail: # pragma: no cover
|
if successemail: # pragma: no cover
|
||||||
handle_sendemail_coursesucceed(
|
handle_sendemail_coursesucceed(
|
||||||
useremail, userfirstname, logfile, workoutid
|
useremail, userfirstname, logfile, workoutid
|
||||||
|
|||||||
@@ -137,7 +137,36 @@
|
|||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if ownrecords %}
|
||||||
|
<li class="grid_4">
|
||||||
|
<h2>Own (Private) Results</h2>
|
||||||
|
<p>
|
||||||
|
<table class="listtable shortpadded">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Distance</th>
|
||||||
|
<th>Date</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for record in ownrecords %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ record.duration |durationprint:"%H:%M:%S.%f" }}</td>
|
||||||
|
<td>{{ record.distance }} m</td>
|
||||||
|
<td>{{ record.workoutid|workoutdate }}</td>
|
||||||
|
<td>
|
||||||
|
<a title="Details" href="/rowers/workout/{{ record.workoutid|encode }}/view/">
|
||||||
|
<i class="fas fa-search-plus fa-fw"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{% if coursescript %}
|
{% if coursescript %}
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h2>Course</h2>
|
<h2><a href="/rowers/courses/{{ plannedsession.course.id }}">{{ plannedsession.course.name }}</h2>
|
||||||
{{ coursediv|safe }}
|
{{ coursediv|safe }}
|
||||||
|
|
||||||
{{ coursescript|safe }}
|
{{ coursescript|safe }}
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -410,12 +410,15 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
except (ValueError, AttributeError): # pragma: no cover
|
except (ValueError, AttributeError): # pragma: no cover
|
||||||
return ('', 'Error: not enough data')
|
return ('', 'Error: not enough data')
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
bins = np.arange(datadf['days ago'].min()-binsize,
|
try:
|
||||||
datadf['days ago'].max()+binsize,
|
bins = np.arange(datadf['days ago'].min()-binsize,
|
||||||
binsize,
|
datadf['days ago'].max()+binsize,
|
||||||
)
|
binsize,
|
||||||
groups = datadf.groupby(pd.cut(datadf['days ago'], bins,
|
)
|
||||||
labels=False))
|
groups = datadf.groupby(pd.cut(datadf['days ago'], bins,
|
||||||
|
labels=False))
|
||||||
|
except (ValueError, AttributeError): # pragma: no cover
|
||||||
|
return ('', 'Error: not enough data')
|
||||||
|
|
||||||
xvalues = []
|
xvalues = []
|
||||||
yvalues = []
|
yvalues = []
|
||||||
|
|||||||
@@ -2332,7 +2332,6 @@ def plannedsession_view(request, id=0, userid=0):
|
|||||||
if ps.sessiontype == 'coursetest': # pragma: no cover
|
if ps.sessiontype == 'coursetest': # pragma: no cover
|
||||||
vs = CourseTestResult.objects.filter(plannedsession=ps,
|
vs = CourseTestResult.objects.filter(plannedsession=ps,
|
||||||
workoutid=w.id)
|
workoutid=w.id)
|
||||||
|
|
||||||
if vs:
|
if vs:
|
||||||
for record in vs:
|
for record in vs:
|
||||||
if record.workoutid == w.id:
|
if record.workoutid == w.id:
|
||||||
|
|||||||
@@ -280,6 +280,13 @@ def course_view(request, id=0):
|
|||||||
workoutid__isnull=False,
|
workoutid__isnull=False,
|
||||||
coursecompleted=True).order_by("duration", "-distance")
|
coursecompleted=True).order_by("duration", "-distance")
|
||||||
|
|
||||||
|
# get own training results
|
||||||
|
ownrecords = CourseTestResult.objects.filter(
|
||||||
|
courseid = course.id,
|
||||||
|
userid = r.id,
|
||||||
|
coursecompleted=True
|
||||||
|
).order_by("duration", "-distance")
|
||||||
|
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
notsharing = Rower.objects.filter(
|
notsharing = Rower.objects.filter(
|
||||||
share_course_results=False).exclude(id=r.id)
|
share_course_results=False).exclude(id=r.id)
|
||||||
@@ -371,6 +378,7 @@ def course_view(request, id=0):
|
|||||||
'mapdiv': div,
|
'mapdiv': div,
|
||||||
'nosessions': False,
|
'nosessions': False,
|
||||||
'records': records,
|
'records': records,
|
||||||
|
'ownrecords': ownrecords,
|
||||||
'rower': r,
|
'rower': r,
|
||||||
'form': form,
|
'form': form,
|
||||||
'onlyme': onlyme,
|
'onlyme': onlyme,
|
||||||
|
|||||||
Reference in New Issue
Block a user