first version with free syncs for basic users
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,7 @@
|
|||||||
# cache
|
# cache
|
||||||
/django_cache/
|
/django_cache/
|
||||||
|
testcert.crt
|
||||||
|
testcert.key
|
||||||
|
|
||||||
# Compiled python modules.
|
# Compiled python modules.
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|||||||
@@ -157,10 +157,6 @@ def add_stroke_data(user,c2id,workoutid,startdatetime,csvfilename,
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def get_c2_workouts(rower):
|
def get_c2_workouts(rower):
|
||||||
|
|
||||||
if not ispromember(rower.user):
|
|
||||||
return 0
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
thetoken = c2_open(rower.user)
|
thetoken = c2_open(rower.user)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ def garmin_getworkout(garminid,r,activity):
|
|||||||
w.name = name
|
w.name = name
|
||||||
w.date = date
|
w.date = date
|
||||||
w.distance = distance
|
w.distance = distance
|
||||||
|
w.uploadedtogarmin = garminid
|
||||||
|
|
||||||
w.save()
|
w.save()
|
||||||
|
|
||||||
@@ -204,12 +205,13 @@ def garmin_workouts_from_details(activities):
|
|||||||
df[' DriveLength (meters)'] = 0
|
df[' DriveLength (meters)'] = 0
|
||||||
df[' PeakDriveForce (lbs)'] = 1
|
df[' PeakDriveForce (lbs)'] = 1
|
||||||
df[' DriveTime (ms)'] = 0
|
df[' DriveTime (ms)'] = 0
|
||||||
print(df.info())
|
|
||||||
rowdata = rowingdata(df=df)
|
rowdata = rowingdata(df=df)
|
||||||
rowdata.write_csv(w.csvfilename,gzip=True)
|
rowdata.write_csv(w.csvfilename,gzip=True)
|
||||||
data = dataprep.dataprep(rowdata.df,id=w.id)
|
data = dataprep.dataprep(rowdata.df,id=w.id)
|
||||||
summary = rowdata.allstats()
|
summary = rowdata.allstats()
|
||||||
w.summary=summary
|
w.summary=summary
|
||||||
|
w.uploadedtogarmin = garminid
|
||||||
w.save()
|
w.save()
|
||||||
except Rower.DoesNotExist:
|
except Rower.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ class Command(BaseCommand):
|
|||||||
message.delete()
|
message.delete()
|
||||||
|
|
||||||
# Strava
|
# Strava
|
||||||
rowers = Rower.objects.filter(strava_auto_import=True).exclude(rowerplan='basic')
|
rowers = Rower.objects.filter(strava_auto_import=True)
|
||||||
for r in rowers:
|
for r in rowers:
|
||||||
stravastuff.get_strava_workouts(r)
|
stravastuff.get_strava_workouts(r)
|
||||||
|
|
||||||
|
|||||||
@@ -126,10 +126,6 @@ def get_strava_workout_list(user,limit_n=0):
|
|||||||
|
|
||||||
# gets all new Strava workouts for a rower
|
# gets all new Strava workouts for a rower
|
||||||
def get_strava_workouts(rower):
|
def get_strava_workouts(rower):
|
||||||
|
|
||||||
if not ispromember(rower.user):
|
|
||||||
return 0
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
thetoken = strava_open(rower.user)
|
thetoken = strava_open(rower.user)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
|
|||||||
@@ -220,6 +220,17 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
<li id="export-garmin">
|
||||||
|
{% if workout.uploadedtogarmin %}
|
||||||
|
<a href="https://connect.garmin.com/modern/activity/{{ workout.uploadedtogarmin }}">
|
||||||
|
Garmin <i class="fas fa-check"></i>
|
||||||
|
</a>
|
||||||
|
{% elif user.rower.garmintoken == None or user.rower.garmintoken == '' %}
|
||||||
|
<a href="/rowers/me/garminauthorize/">
|
||||||
|
Connect to Garmin
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
<li id="export-csv">
|
<li id="export-csv">
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/emailcsv/">
|
<a href="/rowers/workout/{{ workout.id|encode }}/emailcsv/">
|
||||||
CSV
|
CSV
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Automatic Synchronization with other fitness sites</td>
|
<td>Automatic Synchronization with other fitness sites</td>
|
||||||
<td> </td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Import and Export Settings for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Import and Export Settings for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
{% if user.rower.rowerplan == 'basic' %}
|
|
||||||
The auto import and export settings only work on <a href="/rowers/paidplans/">a paid plan</a>.
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if form.errors %}
|
{% if form.errors %}
|
||||||
<p style="color: red;">
|
<p style="color: red;">
|
||||||
Please correct the error{{ form.errors|pluralize }} below.
|
Please correct the error{{ form.errors|pluralize }} below.
|
||||||
@@ -23,8 +19,12 @@ The auto import and export settings only work on <a href="/rowers/paidplans/">a
|
|||||||
<input type="submit" value="Save">
|
<input type="submit" value="Save">
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Garmin Connnect has no manual sync, so connecting your account to your Garmin account will
|
||||||
|
automatically auto-sync workouts from Garmin to Rowsandall (but not in the other direction).
|
||||||
|
</p>
|
||||||
<p>Click on one of the icons below to connect to the service of your
|
<p>Click on one of the icons below to connect to the service of your
|
||||||
choice or to renew the authorization</p>
|
choice or to renew the authorization.</p>
|
||||||
<p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p>
|
<p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p>
|
||||||
<p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
|
<p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
|
||||||
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
|
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ def do_sync(w,options, quick=False):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export and ispromember(w.user.user)):
|
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export):
|
||||||
try:
|
try:
|
||||||
message,id = c2stuff.workout_c2_upload(w.user.user,w,asynchron=True)
|
message,id = c2stuff.workout_c2_upload(w.user.user,w,asynchron=True)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
@@ -544,7 +544,7 @@ def do_sync(w,options, quick=False):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if ('upload_to_Strava' in options and upload_to_strava) or (w.user.strava_auto_export and ispromember(w.user.user)):
|
if ('upload_to_Strava' in options and upload_to_strava) or (w.user.strava_auto_export):
|
||||||
try:
|
try:
|
||||||
message,id = stravastuff.workout_strava_upload(
|
message,id = stravastuff.workout_strava_upload(
|
||||||
w.user.user,w,quick=quick,asynchron=True,
|
w.user.user,w,quick=quick,asynchron=True,
|
||||||
@@ -563,7 +563,7 @@ def do_sync(w,options, quick=False):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and ispromember(w.user.user)):
|
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export):
|
||||||
try:
|
try:
|
||||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||||
w.user.user,w,asynchron=True,
|
w.user.user,w,asynchron=True,
|
||||||
@@ -573,7 +573,7 @@ def do_sync(w,options, quick=False):
|
|||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export and ispromember(w.user.user)):
|
if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export):
|
||||||
try:
|
try:
|
||||||
message,id = runkeeperstuff.workout_runkeeper_upload(
|
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||||
w.user.user,w,asynchron=True,
|
w.user.user,w,asynchron=True,
|
||||||
@@ -582,7 +582,7 @@ def do_sync(w,options, quick=False):
|
|||||||
message = "Please connect to Runkeeper first"
|
message = "Please connect to Runkeeper first"
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export and ispromember(w.user.user)):
|
if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export):
|
||||||
try:
|
try:
|
||||||
message,id = underarmourstuff.workout_ua_upload(
|
message,id = underarmourstuff.workout_ua_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
@@ -592,7 +592,7 @@ def do_sync(w,options, quick=False):
|
|||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export and ispromember(w.user.user)):
|
if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export):
|
||||||
try:
|
try:
|
||||||
message,id = tpstuff.workout_tp_upload(
|
message,id = tpstuff.workout_tp_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
|
|||||||
Reference in New Issue
Block a user