Private
Public Access
1
0

progressing

This commit is contained in:
Sander Roosendaal
2018-11-14 21:58:15 +01:00
parent 1f0a5f5ec9
commit 00539db335
3 changed files with 184 additions and 10 deletions

View File

@@ -85,6 +85,182 @@ stravamapping = {
} }
stmapping = {
'water':'Rowing',
'rower':'Rowing',
'skierg':'Skiing:Nordic',
'bike':'Cycling',
'dynamic':'Rowing',
'slides':'Rowing',
'paddle':'Other:Paddling',
'snow':'Skiing:Nordic',
'coastal':'Rowing',
'c-boat':'Rowing',
'churchboat':'Rowing',
'Ride':'Cycling',
'Kitesurf':'Other:Kitesurf',
'Run':'Running',
'NordicSki':'Skiing:Nordic',
'Swim':'Swimming',
'RockClimbing':'Other:RockClimbing',
'Hike':'Hiking',
'RollerSki':'Other:RollerSki',
'Walk':'Other:Walk',
'AlpineSki':'Skiing:AlpineSki',
'Snowboard':'Other:Snowboard',
'BackcountrySki':'Skiing:BackcountrySki',
'Snowshoe':'Other:Snowshoe',
'Canoeing':'Other:Canoeing',
'StairStepper':'Other:StairStepper',
'Crossfit':'Other:Crossfit',
'StandUpPaddling':'Other:StandUpPaddling',
'EBikeRide':'Cycling:EBikeRide',
'Surfing':'Other:Surfing',
'Elliptical':'Other:Elliptical',
'VirtualRide':'Cycling:VirtualRide',
'IceSkate':'Skating',
'WeightTraining':'Other:WeightTraining',
'InlineSkate':'Skating:InlineSkate',
'Windsurf':'Other:Windsurf',
'Kayaking':'Other:Kayaking',
'Workout':'Other:Workout',
'Yoga':'Other:Yoga',
'other':'Other',
}
rkmapping = {
'water':'Rowing',
'rower':'Rowing',
'skierg':'Cross-Country Skiing',
'bike':'Cycling',
'dynamic':'Rowing',
'slides':'Rowing',
'paddle':'Other:Paddling',
'snow':'Cross-Country Skiing',
'coastal':'Rowing',
'c-boat':'Rowing',
'churchboat':'Rowing',
'Ride':'Cycling',
'Kitesurf':'Other',
'Run':'Running',
'NordicSki':'Cross-Country Skiing',
'Swim':'Swimming',
'RockClimbing':'Other',
'Hike':'Hiking',
'RollerSki':'Other:RollerSki',
'Walk':'Walking',
'AlpineSki':'Downhill Skiing',
'Snowboard':'Snowboarding',
'BackcountrySki':'Downhill Skiing',
'Snowshoe':'Other',
'Canoeing':'Other',
'StairStepper':'Stairmaster',
'Crossfit':'CrossFit',
'StandUpPaddling':'Other',
'EBikeRide':'Cycling',
'Surfing':'Other',
'Elliptical':'Elliptical',
'VirtualRide':'Cycling',
'IceSkate':'Skating',
'WeightTraining':'Other',
'InlineSkate':'Skating',
'Windsurf':'Other',
'Kayaking':'Other',
'Workout':'Other',
'Yoga':'Yoga',
'other':'Other',
}
polarmapping = {
'water':'Rowing',
'rower':'Rowing',
'skierg':'Skiing',
'bike':'Cycling',
'dynamic':'Rowing',
'slides':'Rowing',
'paddle':'Other Outdoor',
'snow':'Skiing',
'coastal':'Rowing',
'c-boat':'Rowing',
'churchboat':'Rowing',
'Ride':'Cycling',
'Kitesurf':'Kitesurfing',
'Run':'Running',
'NordicSki':'Skiing',
'Swim':'Swimming',
'RockClimbing':'Other Outdoor',
'Hike':'Hiking',
'RollerSki':'Other Outdoor',
'Walk':'Walking',
'AlpineSki':'Downhill skiing',
'Snowboard':'Snowboarding',
'BackcountrySki':'Downhill skiing',
'Snowshoe':'Snowshoe trekking',
'Canoeing':'Canoeing',
'StairStepper':'Other Indoor',
'Crossfit':'Crossfit',
'StandUpPaddling':'Other Outdoor',
'EBikeRide':'Cycling',
'Surfing':'Surfing',
'Elliptical':'Other Indoor',
'VirtualRide':'Cycling',
'IceSkate':'Skating',
'WeightTraining':'Other Indoor',
'InlineSkate':'Skating',
'Windsurf':'Windsurfing',
'Kayaking':'Kayaking',
'Workout':'Other Indoor',
'Yoga':'Yoga',
'other':'Other Indoor',
}
tpmapping = {
'water':'rowing',
'rower':'rowing',
'skierg':'xc-ski',
'bike':'bike',
'dynamic':'rowing',
'slides':'rowing',
'paddle':'other',
'snow':'xc-ski',
'coastal':'rowing',
'c-boat':'rowing',
'churchboat':'rowing',
'Ride':'cycling',
'Kitesurf':'other',
'Run':'run',
'NordicSki':'xc-ski',
'Swim':'swim',
'RockClimbing':'other',
'Hike':'other',
'RollerSki':'other',
'Walk':'walk',
'AlpineSki':'other',
'Snowboard':'other',
'BackcountrySki':'other',
'Snowshoe':'other',
'Canoeing':'other',
'StairStepper':'other',
'Crossfit':'other',
'StandUpPaddling':'other',
'EBikeRide':'other',
'Surfing':'other',
'Elliptical':'other',
'VirtualRide':'bike',
'IceSkate':'other',
'WeightTraining':'strength',
'InlineSkate':'other',
'Windsurf':'other',
'Kayaking':'other',
'Workout':'other',
'Yoga':'other',
'other':'other',
}
c2mapping = { c2mapping = {
'water':'water', 'water':'water',
'rower':'rower', 'rower':'rower',
@@ -133,6 +309,12 @@ c2mappinginv = {value:key for key,value in c2mapping.iteritems() if value is not
stravamappinginv = {value:key for key,value in stravamapping.iteritems() if value is not None} stravamappinginv = {value:key for key,value in stravamapping.iteritems() if value is not None}
stmappinginv = {value:key for key,value in stmapping.iteritems() if value is not None}
rkmappinginv = {value:key for key,value in rkmapping.iteritems() if value is not None}
polarmappinginv = {value:key for key,value in polarmapping.iteritems() if value is not None}
otwtypes = ( otwtypes = (
'water', 'water',
'coastal', 'coastal',

View File

@@ -52,7 +52,7 @@ baseurl = 'https://polaraccesslink.com/v3'
from utils import NoTokenError, custom_exception_handler from utils import NoTokenError, custom_exception_handler
import mytypes
# Exchange access code for long-lived access token # Exchange access code for long-lived access token
def get_token(code): def get_token(code):

View File

@@ -10475,15 +10475,7 @@ def workout_runkeeperimport_view(request,message="",userid=0):
def workout_underarmourimport_view(request,message="",userid=0): def workout_underarmourimport_view(request,message="",userid=0):
res = underarmourstuff.get_underarmour_workout_list(request.user) res = underarmourstuff.get_underarmour_workout_list(request.user)
if (res.status_code != 200): if (res.status_code != 200):
if (res.status_code == 401): return HttpResponseRedirect("/rowers/me/underarmourauthorize/")
r = getrower(request.user)
if (r.underarmourtoken == '') or (r.underarmourtoken is None):
s = "Token doesn't exist. Need to authorize"
return HttpResponseRedirect("/rowers/me/underarmourauthorize/")
message = "Something went wrong in workout_underarmourimport_view"
messages.error(request,message)
url = reverse(workouts_view)
return HttpResponseRedirect(url)
workouts = [] workouts = []
items = res.json()['_embedded']['workouts'] items = res.json()['_embedded']['workouts']