@@ -2635,6 +2635,9 @@ class Fix(TimeZoneModelMixin, models.Model):
26352635 """
26362636 Location fix uploaded by user.
26372637 """
2638+
2639+ GRID_SIZE = 0.025
2640+
26382641 user_coverage_uuid = models .CharField (blank = True , null = True , max_length = 36 , help_text = 'UUID randomly generated on '
26392642 'phone to identify each unique user, '
26402643 'but only within the coverage data so '
@@ -2653,9 +2656,8 @@ class Fix(TimeZoneModelMixin, models.Model):
26532656 'as ECMA '
26542657 '262 date time string (e.g. "2014-05-17T12:34:56'
26552658 '.123+01:00".' )
2656- masked_lon = models .FloatField (help_text = 'Longitude rounded down to nearest 0.5 decimal degree (floor(lon/.5)*.5)'
2657- '.' )
2658- masked_lat = models .FloatField (help_text = 'Latitude rounded down to nearest 0.5 decimal degree (floor(lat/.5)*.5).' )
2659+ masked_lon = models .FloatField (help_text = f'Longitude rounded down to nearest { GRID_SIZE } decimal degree.' )
2660+ masked_lat = models .FloatField (help_text = f'Latitude rounded down to nearest { GRID_SIZE } decimal degree.' )
26592661 mask_size = models .FloatField (null = True , blank = True , help_text = 'size of location mask used' )
26602662 power = models .FloatField (null = True , blank = True , help_text = 'Power level of phone at time fix recorded, '
26612663 'expressed as proportion of full charge. Range: 0-1.' )
@@ -2673,6 +2675,12 @@ def _get_latitude_for_timezone(self):
26732675 def _get_longitude_for_timezone (self ):
26742676 return self .masked_lon
26752677
2678+ def save (self , * args , ** kwargs ):
2679+ # Force masking of lat/lon
2680+ self .masked_lon = round (floor (self .masked_lon / self .GRID_SIZE ) * self .GRID_SIZE , 5 )
2681+ self .masked_lat = round (floor (self .masked_lat / self .GRID_SIZE ) * self .GRID_SIZE , 5 )
2682+
2683+ super ().save (* args , ** kwargs )
26762684
26772685 class Meta :
26782686 verbose_name = "fix"
0 commit comments