Changeset b3374f6 in OpenWorkouts-current for ow/models/workout.py
- Timestamp:
- Feb 12, 2019, 5:55:33 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- c999b73e
- Parents:
- f713dbc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/models/workout.py
rf713dbc rb3374f6 14 14 create_blob, 15 15 mps_to_kmph, 16 save_map_screenshot,17 16 timedelta_to_hms 18 17 ) … … 423 422 return self.fit_file is not None 424 423 425 def map_screenshot(self, request): 424 @property 425 def map_screenshot_name(self): 426 return os.path.join( 427 str(self.owner.uid), str(self.workout_id) + '.png') 428 429 @property 430 def map_screenshot_path(self): 431 current_path = os.path.abspath(os.path.dirname(__file__)) 432 return os.path.join( 433 current_path, '../static/maps', self.map_screenshot_name) 434 435 @property 436 def map_screenshot(self): 426 437 """ 427 438 Return the static path to the screenshot image of the map for … … 431 442 return None 432 443 433 screenshot_name = os.path.join( 434 str(self.owner.uid), str(self.workout_id) + '.png') 435 current_path = os.path.abspath(os.path.dirname(__file__)) 436 screenshot_path = os.path.join( 437 current_path, '../static/maps', screenshot_name) 438 439 if not os.path.exists(screenshot_path): 440 # screenshot does not exist, generate it 441 save_map_screenshot(self, request) 442 443 static_path = os.path.join('static/maps', screenshot_name) 444 return request.static_url('ow:' + static_path) 444 if not os.path.exists(self.map_screenshot_path): 445 return None 446 447 static_path = os.path.join('static/maps', self.map_screenshot_name) 448 # return a string we can use with request.static_url 449 return 'ow:' + static_path
Note: See TracChangeset
for help on using the changeset viewer.