first version with free syncs for basic users
This commit is contained in:
@@ -157,10 +157,6 @@ def add_stroke_data(user,c2id,workoutid,startdatetime,csvfilename,
|
||||
return 1
|
||||
|
||||
def get_c2_workouts(rower):
|
||||
|
||||
if not ispromember(rower.user):
|
||||
return 0
|
||||
|
||||
try:
|
||||
thetoken = c2_open(rower.user)
|
||||
except NoTokenError:
|
||||
|
||||
@@ -168,6 +168,7 @@ def garmin_getworkout(garminid,r,activity):
|
||||
w.name = name
|
||||
w.date = date
|
||||
w.distance = distance
|
||||
w.uploadedtogarmin = garminid
|
||||
|
||||
w.save()
|
||||
|
||||
@@ -204,12 +205,13 @@ def garmin_workouts_from_details(activities):
|
||||
df[' DriveLength (meters)'] = 0
|
||||
df[' PeakDriveForce (lbs)'] = 1
|
||||
df[' DriveTime (ms)'] = 0
|
||||
print(df.info())
|
||||
|
||||
rowdata = rowingdata(df=df)
|
||||
rowdata.write_csv(w.csvfilename,gzip=True)
|
||||
data = dataprep.dataprep(rowdata.df,id=w.id)
|
||||
summary = rowdata.allstats()
|
||||
w.summary=summary
|
||||
w.uploadedtogarmin = garminid
|
||||
w.save()
|
||||
except Rower.DoesNotExist:
|
||||
pass
|
||||
|
||||
@@ -296,7 +296,7 @@ class Command(BaseCommand):
|
||||
message.delete()
|
||||
|
||||
# Strava
|
||||
rowers = Rower.objects.filter(strava_auto_import=True).exclude(rowerplan='basic')
|
||||
rowers = Rower.objects.filter(strava_auto_import=True)
|
||||
for r in rowers:
|
||||
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
|
||||
def get_strava_workouts(rower):
|
||||
|
||||
if not ispromember(rower.user):
|
||||
return 0
|
||||
|
||||
try:
|
||||
thetoken = strava_open(rower.user)
|
||||
except NoTokenError:
|
||||
|
||||
@@ -220,6 +220,17 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
</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">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/emailcsv/">
|
||||
CSV
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Automatic Synchronization with other fitness sites</td>
|
||||
<td> </td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
{% block main %}
|
||||
<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 %}
|
||||
<p style="color: red;">
|
||||
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">
|
||||
</form>
|
||||
</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
|
||||
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/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>
|
||||
|
||||
@@ -535,7 +535,7 @@ def do_sync(w,options, quick=False):
|
||||
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:
|
||||
message,id = c2stuff.workout_c2_upload(w.user.user,w,asynchron=True)
|
||||
except NoTokenError:
|
||||
@@ -544,7 +544,7 @@ def do_sync(w,options, quick=False):
|
||||
except:
|
||||
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:
|
||||
message,id = stravastuff.workout_strava_upload(
|
||||
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:
|
||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||
w.user.user,w,asynchron=True,
|
||||
@@ -573,7 +573,7 @@ def do_sync(w,options, quick=False):
|
||||
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:
|
||||
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||
w.user.user,w,asynchron=True,
|
||||
@@ -582,7 +582,7 @@ def do_sync(w,options, quick=False):
|
||||
message = "Please connect to Runkeeper first"
|
||||
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:
|
||||
message,id = underarmourstuff.workout_ua_upload(
|
||||
w.user.user,w
|
||||
@@ -592,7 +592,7 @@ def do_sync(w,options, quick=False):
|
||||
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:
|
||||
message,id = tpstuff.workout_tp_upload(
|
||||
w.user.user,w
|
||||
|
||||
Reference in New Issue
Block a user