adding a setting, auto import only for pro and higher
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from .integrations import SyncIntegration, NoTokenError, create_or_update_syncrecord, get_known_ids
|
||||
from rowers.models import Rower, User, Workout, TombStone, PlannedSession
|
||||
from rowingdata import rowingdata
|
||||
from rowers.rower_rules import user_is_not_basic, user_is_coachee
|
||||
|
||||
from rowers import mytypes
|
||||
|
||||
@@ -545,20 +546,27 @@ class IntervalsIntegration(SyncIntegration):
|
||||
return 1
|
||||
|
||||
def import_activities(self, event, *args, **kwargs):
|
||||
try:
|
||||
record = event["activity"]
|
||||
except KeyError:
|
||||
records = []
|
||||
if not self.rower.intervals_auto_import:
|
||||
return 0
|
||||
if user_is_not_basic(self.rower.user) or user_is_coachee(self.rower.user):
|
||||
try:
|
||||
record = event["activity"]
|
||||
except KeyError:
|
||||
records = []
|
||||
|
||||
try:
|
||||
id = record['id']
|
||||
result = self.get_workout(id)
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
id = record['id']
|
||||
result = self.get_workout(id)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return 1
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
def delete_activities(self, event, *args, **kwargs):
|
||||
if not self.rower.intervals_auto_delete:
|
||||
return 0
|
||||
try:
|
||||
record = event["activity"]
|
||||
except KeyError:
|
||||
|
||||
Reference in New Issue
Block a user