bug fix in C2 upload
This commit is contained in:
@@ -245,7 +245,11 @@ def createc2workoutdata_as_splits(w):
|
||||
# API
|
||||
def createc2workoutdata(w):
|
||||
filename = w.csvfilename
|
||||
row = rowingdata(filename)
|
||||
try:
|
||||
row = rowingdata(filename)
|
||||
except IOError:
|
||||
return 0
|
||||
|
||||
averagehr = int(row.df[' HRCur (bpm)'].mean())
|
||||
maxhr = int(row.df[' HRCur (bpm)'].max())
|
||||
|
||||
|
||||
@@ -190,6 +190,18 @@
|
||||
See (and save) the big interactive plot
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid_2 suffix_2 omega">
|
||||
<p>
|
||||
{% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %}
|
||||
<a class="button blue small" href="/rowers/workout/fusion/{{ workout.id }}/">Sensor Fusion</a>
|
||||
{% else %}
|
||||
<a class="button blue small" href="/rowers/promembership">Dist Metrics Plot</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
Merge data from another source into this workout
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -895,6 +895,16 @@ def workout_c2_upload_view(request,id=0):
|
||||
return HttpResponseRedirect("/rowers/me/c2authorize")
|
||||
|
||||
data = c2stuff.createc2workoutdata(w)
|
||||
if data == 0:
|
||||
message = "Error: No data file. Contact info@rowsandall.com if this problem persists"
|
||||
url = reverse(workout_export_view,
|
||||
kwargs = {
|
||||
'message':str(message),
|
||||
'id':str(w.id),
|
||||
})
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
authorizationstring = str('Bearer ' + thetoken)
|
||||
headers = {'Authorization': authorizationstring,
|
||||
'user-agent': 'sanderroosendaal',
|
||||
|
||||
Reference in New Issue
Block a user