Changeset 42baca4 in OpenWorkouts-current for ow/models/workout.py


Ignore:
Timestamp:
Apr 22, 2019, 6:14:53 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current
Children:
0dedfbe
Parents:
e52a502
Message:

(#39) Do not allow duplicated workouts by default when uploading track files.
We still allow users to add duplicates if they want, by checking a checkbox
we show in the upload workout form when we find a possible duplicate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/models/workout.py

    re52a502 r42baca4  
    136136
    137137    @property
     138    def hashed(self):
     139        """
     140        Return a unique hash that we use to look for duplicated workouts.
     141        The hash contains: owner's uid, start time, duration and distance
     142        """
     143        hashed = ''
     144        if self.owner is not None:
     145            hashed += str(self.owner.uid)
     146        hashed += self.start.strftime('%Y%m%d%H%M%S')
     147        hashed += str(self.duration.seconds)
     148        hashed += str(self.distance)
     149        return hashed
     150
     151    @property
    138152    def trimmed_notes(self):
    139153        """
Note: See TracChangeset for help on using the changeset viewer.