Skip to content

Commit c979e1f

Browse files
committed
API - minor refactoring + update endpoint documentation
1 parent 232512a commit c979e1f

File tree

3 files changed

+37
-127
lines changed

3 files changed

+37
-127
lines changed

fittrackee/tests/workouts/test_services/from_file/test_workout_gpx_service.py

Lines changed: 25 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -50,131 +50,31 @@
5050

5151
OPEN_ELEVATION_RESPONSE = {
5252
"results": [
53-
{
54-
"elevation": 998.0,
55-
"latitude": 44.68095,
56-
"longitude": 6.07367,
57-
},
58-
{
59-
"elevation": 998.0,
60-
"latitude": 44.68091,
61-
"longitude": 6.07367,
62-
},
63-
{
64-
"elevation": 994.0,
65-
"latitude": 44.6808,
66-
"longitude": 6.07364,
67-
},
68-
{
69-
"elevation": 994.0,
70-
"latitude": 44.68075,
71-
"longitude": 6.07364,
72-
},
73-
{
74-
"elevation": 994.0,
75-
"latitude": 44.68071,
76-
"longitude": 6.07364,
77-
},
78-
{
79-
"elevation": 993.0,
80-
"latitude": 44.68049,
81-
"longitude": 6.07361,
82-
},
83-
{
84-
"elevation": 992.0,
85-
"latitude": 44.68019,
86-
"longitude": 6.07356,
87-
},
88-
{
89-
"elevation": 992.0,
90-
"latitude": 44.68014,
91-
"longitude": 6.07355,
92-
},
93-
{
94-
"elevation": 987.0,
95-
"latitude": 44.67995,
96-
"longitude": 6.07358,
97-
},
98-
{
99-
"elevation": 987.0,
100-
"latitude": 44.67977,
101-
"longitude": 6.07364,
102-
},
103-
{
104-
"elevation": 987.0,
105-
"latitude": 44.67972,
106-
"longitude": 6.07367,
107-
},
108-
{
109-
"elevation": 987.0,
110-
"latitude": 44.67966,
111-
"longitude": 6.07368,
112-
},
113-
{
114-
"elevation": 986.0,
115-
"latitude": 44.67961,
116-
"longitude": 6.0737,
117-
},
118-
{
119-
"elevation": 986.0,
120-
"latitude": 44.67938,
121-
"longitude": 6.07377,
122-
},
123-
{
124-
"elevation": 986.0,
125-
"latitude": 44.67933,
126-
"longitude": 6.07381,
127-
},
128-
{
129-
"elevation": 985.0,
130-
"latitude": 44.67922,
131-
"longitude": 6.07385,
132-
},
133-
{
134-
"elevation": 980.0,
135-
"latitude": 44.67911,
136-
"longitude": 6.0739,
137-
},
138-
{
139-
"elevation": 980.0,
140-
"latitude": 44.679,
141-
"longitude": 6.07399,
142-
},
143-
{
144-
"elevation": 980.0,
145-
"latitude": 44.67896,
146-
"longitude": 6.07402,
147-
},
148-
{
149-
"elevation": 979.0,
150-
"latitude": 44.67884,
151-
"longitude": 6.07408,
152-
},
153-
{
154-
"elevation": 981.0,
155-
"latitude": 44.67863,
156-
"longitude": 6.07423,
157-
},
158-
{
159-
"elevation": 980.0,
160-
"latitude": 44.67858,
161-
"longitude": 6.07425,
162-
},
163-
{
164-
"elevation": 979.0,
165-
"latitude": 44.67842,
166-
"longitude": 6.07434,
167-
},
168-
{
169-
"elevation": 979.0,
170-
"latitude": 44.67837,
171-
"longitude": 6.07435,
172-
},
173-
{
174-
"elevation": 975.0,
175-
"latitude": 44.67822,
176-
"longitude": 6.07442,
177-
},
53+
{"elevation": 998.0, "latitude": 44.68095, "longitude": 6.07367},
54+
{"elevation": 998.0, "latitude": 44.68091, "longitude": 6.07367},
55+
{"elevation": 994.0, "latitude": 44.6808, "longitude": 6.07364},
56+
{"elevation": 994.0, "latitude": 44.68075, "longitude": 6.07364},
57+
{"elevation": 994.0, "latitude": 44.68071, "longitude": 6.07364},
58+
{"elevation": 993.0, "latitude": 44.68049, "longitude": 6.07361},
59+
{"elevation": 992.0, "latitude": 44.68019, "longitude": 6.07356},
60+
{"elevation": 992.0, "latitude": 44.68014, "longitude": 6.07355},
61+
{"elevation": 987.0, "latitude": 44.67995, "longitude": 6.07358},
62+
{"elevation": 987.0, "latitude": 44.67977, "longitude": 6.07364},
63+
{"elevation": 987.0, "latitude": 44.67972, "longitude": 6.07367},
64+
{"elevation": 987.0, "latitude": 44.67966, "longitude": 6.07368},
65+
{"elevation": 986.0, "latitude": 44.67961, "longitude": 6.0737},
66+
{"elevation": 986.0, "latitude": 44.67938, "longitude": 6.07377},
67+
{"elevation": 986.0, "latitude": 44.67933, "longitude": 6.07381},
68+
{"elevation": 985.0, "latitude": 44.67922, "longitude": 6.07385},
69+
{"elevation": 980.0, "latitude": 44.67911, "longitude": 6.0739},
70+
{"elevation": 980.0, "latitude": 44.679, "longitude": 6.07399},
71+
{"elevation": 980.0, "latitude": 44.67896, "longitude": 6.07402},
72+
{"elevation": 979.0, "latitude": 44.67884, "longitude": 6.07408},
73+
{"elevation": 981.0, "latitude": 44.67863, "longitude": 6.07423},
74+
{"elevation": 980.0, "latitude": 44.67858, "longitude": 6.07425},
75+
{"elevation": 979.0, "latitude": 44.67842, "longitude": 6.07434},
76+
{"elevation": 979.0, "latitude": 44.67837, "longitude": 6.07435},
77+
{"elevation": 975.0, "latitude": 44.67822, "longitude": 6.07442},
17878
]
17979
}
18080

fittrackee/workouts/services/workout_from_file/workout_gpx_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ def _process_segment_points(
254254
segment_points: List[Dict] = []
255255
coordinates = []
256256

257-
# Add elevation if OpenElevation is set and at least one value is
258-
# missing:
257+
# Add elevation if:
258+
# - OpenElevation URL is set
259+
# - user preference is set
260+
# - and at least one value is missing
259261
elevations = []
260262
update_missing_elevation = MissingElevationsProcessing.NONE
261263

fittrackee/workouts/workouts.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ def get_workouts(auth_user: User) -> Union[Dict, HttpResponse]:
430430
"max_speed": 18.0,
431431
"min_alt": null,
432432
"modification_date": null,
433+
"missing_elevations_processing": 'none',
433434
"moving": "1:00:00",
434435
"next_workout": null,
435436
"notes": "",
@@ -1291,6 +1292,7 @@ def get_workout(
12911292
"max_power": null,
12921293
"max_speed": 16,
12931294
"min_alt": null,
1295+
"missing_elevations_processing": 'none',
12941296
"modification_date": "Sun, 14 Jul 2019 18:57:22 GMT",
12951297
"moving": "0:45:00",
12961298
"next_workout": 4,
@@ -2013,6 +2015,7 @@ def post_workout(auth_user: User) -> Union[Tuple[Dict, int], HttpResponse]:
20132015
"max_power": null,
20142016
"max_speed": 25.59,
20152017
"min_alt": 55.03,
2018+
"missing_elevations_processing": 'none',
20162019
"modification_date": null,
20172020
"moving": "1:47:11",
20182021
"next_workout": "Kd5wyhwLtVozw6o3AU5M4J",
@@ -2314,6 +2317,7 @@ def post_workout_no_gpx(
23142317
"max_power": null,
23152318
"max_speed": 10.0,
23162319
"min_alt": null,
2320+
"missing_elevations_processing": 'none',
23172321
"modification_date": null,
23182322
"moving": "0:17:04",
23192323
"next_workout": 3,
@@ -2536,6 +2540,7 @@ def update_workout(
25362540
"max_power": null,
25372541
"max_speed": 10.0,
25382542
"min_alt": null,
2543+
"missing_elevations_processing": 'none',
25392544
"modification_date": null,
25402545
"moving": "0:17:04",
25412546
"next_workout": 3,
@@ -2810,6 +2815,7 @@ def like_workout(
28102815
"max_power": null,
28112816
"max_speed": 25.59,
28122817
"min_alt": 19.0,
2818+
"missing_elevations_processing": 'none',
28132819
"modification_date": "Wed, 04 Dec 2024 16:45:14 GMT",
28142820
"moving": "1:47:04",
28152821
"next_workout": null,
@@ -2925,6 +2931,7 @@ def undo_workout_like(
29252931
"max_power": null,
29262932
"max_speed": 25.59,
29272933
"min_alt": 19.0,
2934+
"missing_elevations_processing": 'none',
29282935
"modification_date": "Wed, 04 Dec 2024 16:45:14 GMT",
29292936
"moving": "1:47:04",
29302937
"next_workout": null,
@@ -3528,6 +3535,7 @@ def refresh_workout(
35283535
"max_power": null,
35293536
"max_speed": 25.59,
35303537
"min_alt": 55.03,
3538+
"missing_elevations_processing": 'none',
35313539
"modification_date": null,
35323540
"moving": "1:47:11",
35333541
"next_workout": "Kd5wyhwLtVozw6o3AU5M4J",

0 commit comments

Comments
 (0)