parametrizing viewer location
This commit is contained in:
@@ -30,6 +30,8 @@ from rowers.utils import NoTokenError, step_to_string
|
|||||||
|
|
||||||
import rowers.payments as payments
|
import rowers.payments as payments
|
||||||
|
|
||||||
|
from rowsandall_app.settings import NK_VIEWER_LOCATION
|
||||||
|
|
||||||
|
|
||||||
from rowers.opaque import encoder
|
from rowers.opaque import encoder
|
||||||
from rowers.plannedsessions import ps_dict_get_description_html
|
from rowers.plannedsessions import ps_dict_get_description_html
|
||||||
@@ -108,7 +110,9 @@ def adaptive(s):
|
|||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def nkviewerlink(workout):
|
def nkviewerlink(workout):
|
||||||
url = "https://viewer-stage.nkrowlink.com/workout-analysis/{nkid}".format(nkid=workout.uploadedtonk)
|
url = "{nkviewer}{nkid}".format(
|
||||||
|
nkid=workout.uploadedtonk,
|
||||||
|
nkviewer=NK_VIEWER_LOCATION)
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|||||||
@@ -844,6 +844,24 @@ def workout_nkimport_view(request,userid=0):
|
|||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
# get NK IDs
|
# get NK IDs
|
||||||
|
nkids = [item['id'] for item in res.json()]
|
||||||
|
knownnkids = uniqify([
|
||||||
|
w.uploadedtonk for w in Workout.objects.filter(user=r)
|
||||||
|
])
|
||||||
|
tombstones = [
|
||||||
|
t.uploadedtonk for t in TombStone.objects.filter(user=r)
|
||||||
|
]
|
||||||
|
parkedids = []
|
||||||
|
try:
|
||||||
|
with open('nkblocked.json','r') as nkblocked:
|
||||||
|
jsondata = json.load(nkplocked)
|
||||||
|
parkedids = jsondata['ids']
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
knownnkids = uniqify(knownnkids+tombstones+parkedids)
|
||||||
|
newids = [nkid for nkid in nkids if not nkid in knownnkids]
|
||||||
|
|
||||||
|
|
||||||
nkdata = [{
|
nkdata = [{
|
||||||
'id':int(item['id']),
|
'id':int(item['id']),
|
||||||
@@ -857,7 +875,10 @@ def workout_nkimport_view(request,userid=0):
|
|||||||
d = int(float(item['totalDistanceGps'])) # could also be Impeller
|
d = int(float(item['totalDistanceGps'])) # could also be Impeller
|
||||||
i = item['id']
|
i = item['id']
|
||||||
n = item['name']
|
n = item['name']
|
||||||
nnn = ''
|
if i in knownnkids:
|
||||||
|
nnn = ''
|
||||||
|
else:
|
||||||
|
nnn = 'NEW'
|
||||||
ttot = str(datetime.timedelta(seconds=int(float(item['elapsedTime'])/1000.)))
|
ttot = str(datetime.timedelta(seconds=int(float(item['elapsedTime'])/1000.)))
|
||||||
s = arrow.get(item['startTime'],tzinfo=r.defaulttimezone).format(arrow.FORMAT_RFC850)
|
s = arrow.get(item['startTime'],tzinfo=r.defaulttimezone).format(arrow.FORMAT_RFC850)
|
||||||
#s = arrow.get(item['startTime']).to(r.defaulttimezone).isoformat()
|
#s = arrow.get(item['startTime']).to(r.defaulttimezone).isoformat()
|
||||||
|
|||||||
@@ -333,6 +333,7 @@ NK_CLIENT_ID = CFG["nk_client_id"]
|
|||||||
NK_CLIENT_SECRET = CFG["nk_client_secret"]
|
NK_CLIENT_SECRET = CFG["nk_client_secret"]
|
||||||
NK_REDIRECT_URI = CFG["nk_redirect_uri"]
|
NK_REDIRECT_URI = CFG["nk_redirect_uri"]
|
||||||
NK_API_LOCATION = CFG["nk_api_location"]
|
NK_API_LOCATION = CFG["nk_api_location"]
|
||||||
|
NK_VIEWER_LOCATION = CFG["nk_viewer_location"]
|
||||||
|
|
||||||
# Full Site URL
|
# Full Site URL
|
||||||
SITE_URL = CFG['site_url']
|
SITE_URL = CFG['site_url']
|
||||||
|
|||||||
Reference in New Issue
Block a user