Private
Public Access
1
0

Merge branch 'develop' into feature/mapcompare

This commit is contained in:
Sander Roosendaal
2020-06-03 13:23:08 +02:00
3 changed files with 34 additions and 8 deletions

View File

@@ -24,6 +24,22 @@ queuehigh = django_rq.get_queue('low')
import pandas as pd
from rowingdata import rowingdata as rrdata
from rowingdata import rower as rrower
# Wrapper around the rowingdata call to catch some exceptions
# Checks for CSV file, then for gzipped CSV file, and if all fails, returns 0
def rdata(file,rower=rrower()):
try:
res = rrdata(csvfile=file,rower=rower)
except (IOError, IndexError, EOFError,FileNotFoundError):
try:
res = rrdata(csvfile=file+'.gz',rower=rower)
except (IOError, IndexError, EOFError,FileNotFoundError):
res = 0
return res
from rowers.models import (
Rower, Workout,Team,
GeoCourse, TrainingMicroCycle,TrainingMesoCycle,TrainingMacroCycle,
@@ -1531,6 +1547,14 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
# start adding sessions
if ws[0].startdatetime>=startdatetime and ws[0].startdatetime<=enddatetime:
# convert to gps
row = rdata(ws[0].csvfilename)
success = row.use_gpsdata()
if success:
row.write_csv(ws[0].csvfilename)
dataprep.update_strokedata(ws[0].id,row.df)
ws[0].impeller = False
ws[0].plannedsession = race
ws[0].save()
result += 1