diff --git a/rowers/courses.py b/rowers/courses.py index 3e9fa947..43a3b8ea 100644 --- a/rowers/courses.py +++ b/rowers/courses.py @@ -36,6 +36,21 @@ from rowers.models import VirtualRace # distance of course from lat_lon in km +def pass_start(df, course): + if df.empty: + return False + + def f(x): + return coordinate_in_path(x[' latitude'], x[' longitude'], p) + + + polygons = course.polygons.all() + p = polygon_to_path(polygons[0]) + + inpolygon = df.apply(lambda row:f(row), axis=1).copy() + + return inpolygon.any() + def howfaris(lat_lon, course): coords = course.coord diff --git a/rowers/courseutils.py b/rowers/courseutils.py index c60f0034..c4422cc6 100644 --- a/rowers/courseutils.py +++ b/rowers/courseutils.py @@ -14,7 +14,6 @@ class InvalidTrajectoryError(Exception): def __str__(self): # pragma: no cover return repr(self.value) - def time_in_path(df, p, maxmin='max', getall=False, name='unknown', logfile=None): if df.empty: # pragma: no cover diff --git a/rowers/models.py b/rowers/models.py index 4b40e835..5ddc51dc 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -3727,6 +3727,18 @@ class Workout(models.Model): elif self.workouttype in mytypes.otetypes and self.boattype in mytypes.boattypes: self.boattype = 'static' + records = VirtualRaceResult.objects.filter(workoutid=self.pk) + for record in records: + record.boattype = self.boattype + record.boatclass = self.workouttype + record.save() + + records = IndoorVirtualRaceResult.objects.filter(workoutid=self.pk) + for record in records: + record.boattype = self.boattype + record.boatclass = self.workouttype + record.save() + super(Workout, self).save(*args, **kwargs) def __str__(self): diff --git a/rowers/templates/mapcompare.html b/rowers/templates/mapcompare.html index 49fad21f..76e3b1d0 100644 --- a/rowers/templates/mapcompare.html +++ b/rowers/templates/mapcompare.html @@ -21,6 +21,7 @@