Changeset c555386 in OpenWorkouts-current
- Timestamp:
- Jan 11, 2019, 11:56:20 AM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- d17dffe
- Parents:
- b73ae09
- Location:
- ow
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/fit.py
rb73ae09 rc555386 116 116 # The schema namespaces info is very important, in order to support 117 117 # all the data we will extract from the fit file. 118 118 119 gpx = gpxpy.gpx.GPX() 119 120 gpx.creator = 'OpenWorkouts' … … 202 203 latitude=semicircles_to_degrees(values['position_lat']), 203 204 longitude=semicircles_to_degrees(values['position_long']), 204 elevation=values['enhanced_altitude'],205 speed=values['enhanced_speed'],206 205 time=values['timestamp'] 207 206 ) 208 207 209 track_point.extensions.append(extensions_root) 210 211 gpx_segment.points.append(track_point) 208 if 'enhanced_altitude' in values.keys(): 209 track_point.elevation = values['enhanced_altitude'] 210 211 if 'enhanced_speed' in values.keys(): 212 track_point.speed = values['enhanced_speed'] 213 214 track_point.extensions.append(extensions_root) 215 216 gpx_segment.points.append(track_point) 212 217 213 218 # if the fit file has temperature data, calculate the avg -
ow/models/workout.py
rb73ae09 rc555386 360 360 361 361 # grab the needed data from the fit file, update the workout 362 self.sport = fit.data['sport'] 362 363 self.start = fit.data['start'] 363 364 # ensure this datetime start object is timezone-aware … … 365 366 # duration comes in seconds, store a timedelta 366 367 self.duration = timedelta(seconds=fit.data['duration']) 367 # distance comes in meters 368 self.distance = Decimal(fit.data['distance']) / Decimal(1000.00) 369 self.uphill = Decimal(fit.data['uphill']) 370 self.downhill = Decimal(fit.data['downhill']) 368 if fit.data['distance']: 369 # distance comes in meters 370 self.distance = Decimal(fit.data['distance']) / Decimal(1000.00) 371 if fit.data['uphill']: 372 self.uphill = Decimal(fit.data['uphill']) 373 if fit.data['downhill']: 374 self.downhill = Decimal(fit.data['downhill']) 371 375 # If the user did not provide us with a title, build one from the 372 376 # info in the fit file -
ow/tests/fixtures/20181230_101115.gpx
rb73ae09 rc555386 58269 58269 <gpxtpx:cad>0</gpxtpx:cad> 58270 58270 </gpxtpx:TrackPointExtension> 58271 <gpxtpx:TrackPointExtension>58272 <gpxtpx:atemp>3</gpxtpx:atemp>58273 <gpxtpx:hr>139</gpxtpx:hr>58274 <gpxtpx:cad>0</gpxtpx:cad>58275 </gpxtpx:TrackPointExtension>58276 </extensions>58277 </trkpt>58278 <trkpt lat="43.02351839840412" lon="-7.338556135073304">58279 <ele>726.0</ele>58280 <time>2018-12-30T11:48:21Z</time>58281 <extensions>58282 <gpxtpx:TrackPointExtension>58283 <gpxtpx:atemp>3</gpxtpx:atemp>58284 <gpxtpx:hr>140</gpxtpx:hr>58285 <gpxtpx:cad>0</gpxtpx:cad>58286 </gpxtpx:TrackPointExtension>58287 <gpxtpx:TrackPointExtension>58288 <gpxtpx:atemp>3</gpxtpx:atemp>58289 <gpxtpx:hr>139</gpxtpx:hr>58290 <gpxtpx:cad>0</gpxtpx:cad>58291 </gpxtpx:TrackPointExtension>58292 58271 </extensions> 58293 58272 </trkpt>
Note: See TracChangeset
for help on using the changeset viewer.