Private
Public Access
1
0

bug fix in C2 upload

This commit is contained in:
Sander Roosendaal
2017-03-12 23:21:18 +01:00
parent d9e9fbcdcd
commit a1023884bd
3 changed files with 27 additions and 1 deletions

View File

@@ -245,7 +245,11 @@ def createc2workoutdata_as_splits(w):
# API # API
def createc2workoutdata(w): def createc2workoutdata(w):
filename = w.csvfilename filename = w.csvfilename
row = rowingdata(filename) try:
row = rowingdata(filename)
except IOError:
return 0
averagehr = int(row.df[' HRCur (bpm)'].mean()) averagehr = int(row.df[' HRCur (bpm)'].mean())
maxhr = int(row.df[' HRCur (bpm)'].max()) maxhr = int(row.df[' HRCur (bpm)'].max())

View File

@@ -190,6 +190,18 @@
See (and save) the big interactive plot See (and save) the big interactive plot
</p> </p>
</div> </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>
</div> </div>

View File

@@ -895,6 +895,16 @@ def workout_c2_upload_view(request,id=0):
return HttpResponseRedirect("/rowers/me/c2authorize") return HttpResponseRedirect("/rowers/me/c2authorize")
data = c2stuff.createc2workoutdata(w) 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) authorizationstring = str('Bearer ' + thetoken)
headers = {'Authorization': authorizationstring, headers = {'Authorization': authorizationstring,
'user-agent': 'sanderroosendaal', 'user-agent': 'sanderroosendaal',