diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 1de838d4..9ebc2adb 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -15,6 +15,7 @@ from pandas import DataFrame,Series from pytz import timezone as tz,utc from django.utils import timezone from time import strftime,strptime,mktime,time,daylight +import arrow from django.utils.timezone import get_current_timezone thetimezone = get_current_timezone() from rowingdata import ( @@ -1012,7 +1013,8 @@ def new_workout_from_df(r,df, df.rename(columns = columndict,inplace=True) - starttimeunix = mktime(startdatetime.utctimetuple()) + #starttimeunix = mktime(startdatetime.utctimetuple()) + starttimeunix = arrow.get(startdatetime).timestamp df[' ElapsedTime (sec)'] = df['TimeStamp (sec)'] df['TimeStamp (sec)'] = df['TimeStamp (sec)']+starttimeunix diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index a10c5763..989e4401 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -691,8 +691,23 @@ def leaflet_chart(lat,lon,name=""): if lat.empty or lon.empty: return [0,"invalid coordinate data"] + + # Throw out 0,0 + df = pd.DataFrame({ + 'lat':lat, + 'lon':lon + }) + + df = df.replace(0,np.nan) + df = df.loc[(df!=0).any(axis=1)] + lat = df['lat'] + lon = df['lon'] + if lat.empty or lon.empty: + return [0,"invalid coordinate data"] + latmean = lat.mean() lonmean = lon.mean() + latbegin = lat[lat.index[0]] longbegin = lon[lon.index[0]] latend = lat[lat.index[-1]] @@ -796,6 +811,20 @@ def leaflet_chart2(lat,lon,name=""): if lat.empty or lon.empty: return [0,"invalid coordinate data"] + + # Throw out 0,0 + df = pd.DataFrame({ + 'lat':lat, + 'lon':lon + }) + + df = df.replace(0,np.nan) + df = df.loc[(df!=0).any(axis=1)] + lat = df['lat'] + lon = df['lon'] + if lat.empty or lon.empty: + return [0,"invalid coordinate data"] + latmean = lat.mean() lonmean = lon.mean() latbegin = lat[lat.index[0]] diff --git a/rowers/templates/developers.html b/rowers/templates/developers.html index b81bb596..117a4547 100644 --- a/rowers/templates/developers.html +++ b/rowers/templates/developers.html @@ -126,6 +126,10 @@ expires, use the refresh token to refresh it.

+

The redirect URI for user authentication has to be https. + Developers of iOS or Android apps should contact me directly if + this doesn't work for them. I can add exceptions.

+

The POST call must have content-type: x-www-form-urlencoded. I set it this way to support the handy testing utility mentioned belower. However, diff --git a/rowers/templates/list_workouts.html b/rowers/templates/list_workouts.html index d2158284..61cbc9ae 100644 --- a/rowers/templates/list_workouts.html +++ b/rowers/templates/list_workouts.html @@ -51,7 +51,7 @@ - + @@ -76,9 +76,9 @@ {% else %} {% endif %} - - - + +
Date Date Time Name Type
{{ workout.date |truncatechars:15}} {{ workout.starttime }} + {{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }} {% if workout.user.user == user or user == team.manager %} {% if workout.rankingpiece %} [RANKING PIECE] diff --git a/rowers/views.py b/rowers/views.py index 48afb7d4..4e0c38e5 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -4342,17 +4342,17 @@ def workouts_view(request,message='',successmessage='', if theteam.viewing == 'allmembers' or theteam.manager == request.user: workouts = Workout.objects.filter(team=theteam, startdatetime__gte=startdate, - startdatetime__lte=enddate).order_by("-date", "-starttime") + startdatetime__lte=enddate).order_by("-startdatetime") g_workouts = Workout.objects.filter(team=theteam, startdatetime__gte=activity_startdate, startdatetime__lte=activity_enddate).order_by("-date", "-starttime") elif theteam.viewing == 'coachonly': workouts = Workout.objects.filter(team=theteam,user=r, startdatetime__gte=startdate, - startdatetime__lte=enddate).order_by("-date","-starttime") + startdatetime__lte=enddate).order_by("-startdatetime") g_workouts = Workout.objects.filter(team=theteam,user=r, startdatetime__gte=activity_startdate, - enddatetime__lte=activity_enddate).order_by("-date","-starttime") + enddatetime__lte=activity_enddate).order_by("-startdatetime") else: @@ -4362,7 +4362,7 @@ def workouts_view(request,message='',successmessage='', startdatetime__lte=enddate).order_by("-date", "-starttime") g_workouts = Workout.objects.filter(user=r, startdatetime__gte=activity_startdate, - startdatetime__lte=activity_enddate).order_by("-date","-starttime") + startdatetime__lte=activity_enddate).order_by("-startdatetime") query = request.GET.get('q') if query: diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index 4efa6348..8148d40c 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -324,6 +324,9 @@ GMAPIKEY = CFG['gmapikey'] OAUTH2_PROVIDER = { # this is the list of available scopes 'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}, + 'ALLOWED_REDIRECT_URI_SCHEMES': ["http", + "https", + "rowingcoachexport"] # 'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore' }