- Timestamp:
- Feb 10, 2019, 8:28:44 AM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- e547af5
- Parents:
- 6662a84
- Location:
- ow
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/models/workout.py
r6662a84 rd7a9df5 1 1 import os 2 import textwrap 2 3 from datetime import datetime, timedelta, timezone 3 4 from decimal import Decimal … … 136 137 137 138 @property 139 def trimmed_notes(self): 140 """ 141 Return a string with a reduced version of the full notes for this 142 workout. 143 """ 144 return textwrap.shorten(self.notes, width=225, placeholder=' ...') 145 146 @property 138 147 def has_hr(self): 139 148 """ -
ow/templates/dashboard.pt
r6662a84 rd7a9df5 56 56 <ul class="workout-info"> 57 57 <li> 58 <tal:c tal:content="workout.sport"></tal:c> 59 </li> 60 <li> 58 61 <tal:c tal:content="workout.start_in_timezone(context.timezone)"></tal:c> 59 62 </li> … … 70 73 </ul> 71 74 72 <ul class="workout-info" tal:define="hr workout.hr; cad workout.cad"> 73 <li tal:condition="hr"> 74 <span i18n:translate="">HR (bpm)</span>: 75 <tal:c tal:content="hr['avg']"></tal:c> 76 <tal:t i18n:translate="">Avg.</tal:t>, 77 <tal:c tal:content="hr['max']"></tal:c> 78 <tal:t i18n:translate="">Max.</tal:t> 79 </li> 80 <li tal:condition="cad"> 81 <span i18n:translate="">Cad</span>: 82 <tal:c tal:content="cad['avg']"></tal:c> 83 <tal:t i18n:translate="">Avg.</tal:t>, 84 <tal:c tal:content="cad['max']"></tal:c> 85 <tal:t i18n:translate="">Max.</tal:t> 86 </li> 87 </ul> 88 89 <div class="workout-intro" tal:content="workout.notes"></div> 75 <div class="workout-intro"> 76 <p tal:repeat="paragraph workout.trimmed_notes.split('\n')" 77 tal:content="paragraph"></p> 78 </div> 90 79 91 80 <div class="workout-map" tal:condition="workout.has_gpx"> -
ow/templates/profile.pt
r6662a84 rd7a9df5 138 138 139 139 <div class="workout-intro"> 140 <p tal:repeat="paragraph workout. notes.split('\n')"140 <p tal:repeat="paragraph workout.trimmed_notes.split('\n')" 141 141 tal:content="paragraph"></p> 142 142 </div> -
ow/tests/models/test_workout.py
r6662a84 rd7a9df5 143 143 workout.distance = 44.44444444 144 144 assert workout.rounded_distance == 44.44 145 146 def test_trimmed_notes(self): 147 workout = Workout() 148 assert workout.notes == '' 149 assert workout.trimmed_notes == '' 150 workout.notes = 'very short notes' 151 assert workout.notes == 'very short notes' 152 assert workout.trimmed_notes == 'very short notes' 153 workout.notes = 'long notes now, repeated' * 1000 154 assert len(workout.notes) == 24000 155 assert len(workout.trimmed_notes) == 224 156 assert workout.trimmed_notes.endswith(' ...') 145 157 146 158 def test_has_hr(self):
Note: See TracChangeset
for help on using the changeset viewer.