diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index 855d0831..b3e43767 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -2126,6 +2126,7 @@ def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True, filename = 'media/strokedata_{id}.parquet.gz'.format(id=id) df = dd.from_pandas(data, npartitions=1) + if polars: pldf = pl.from_pandas(data) try: @@ -2139,6 +2140,10 @@ def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True, except FileNotFoundError: df2 = dd.from_pandas(df, npartitions=1) df2.to_parquet(filename, engine='fastparquet', compression='gzip') + except FileExistsError: + os.remove(filename) + df.to_parquet(filename, engine='fastparquet', compression='GZIP') + return data diff --git a/rowers/views/racesviews.py b/rowers/views/racesviews.py index 483d0d6a..fd1c4259 100644 --- a/rowers/views/racesviews.py +++ b/rowers/views/racesviews.py @@ -371,11 +371,14 @@ def course_view(request, id=0): coursecompleted=True).order_by("duration", "-distance") # get own training results - ownrecords = CourseTestResult.objects.filter( - courseid = course.id, - userid = r.id, - coursecompleted=True - ).order_by("duration", "-distance") + if not request.user.is_anonymous: + ownrecords = CourseTestResult.objects.filter( + courseid = course.id, + userid = r.id, + coursecompleted=True + ).order_by("duration", "-distance") + else: + ownrecords = [] if request.user.is_authenticated: notsharing = Rower.objects.filter(