Private
Public Access
1
0

adding strava auto delete

This commit is contained in:
Sander Roosendaal
2020-07-24 10:10:42 +02:00
parent 2666f3f78f
commit 42636ed9cd
4 changed files with 12 additions and 3 deletions

View File

@@ -853,6 +853,7 @@ class Rower(models.Model):
strava_auto_export = models.BooleanField(default=False)
strava_auto_import = models.BooleanField(default=False)
strava_auto_delete = models.BooleanField(default=False)
runkeepertoken = models.CharField(default='',max_length=200,
blank=True,null=True)
runkeeper_auto_export = models.BooleanField(default=False)
@@ -3443,6 +3444,7 @@ class RowerExportForm(ModelForm):
'sporttracks_auto_export',
'strava_auto_export',
'strava_auto_import',
'strava_auto_delete',
'trainingpeaks_auto_export',
]

View File

@@ -57,6 +57,11 @@
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>
Strava Auto Import also imports activity changes on Strava to Rowsandall, except when you delete
a workout on Strava. If you want Deletions to propagate to Rowsandall, tick the Strava Auto Delete
check box.
</p>
<p>Click on one of the icons below to connect to the service of your
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>

View File

@@ -1098,9 +1098,10 @@ def strava_webhook_view(request):
f.write(' ')
f.write('Rower not found')
return HttpResponse(status=200)
for w in ws:
if w.user == r:
w.delete()
if Rower.strava_auto_delete:
for w in ws:
if w.user == r:
w.delete()
elif aspect_type == 'update':
try:
updates = data['updates']

View File

@@ -307,6 +307,7 @@ def rower_exportsettings_view(request,userid=0):
'sporttracks_auto_export':'sporttrackstoken',
'strava_auto_export':'stravatoken',
'strava_auto_import':'stravatoken',
'strava_auto_delete':'stravatoken',
'trainingpeaks_auto_export':'tptoken',
}
r = getrequestrower(request,userid=userid)