fix linting issues

This commit is contained in:
Joshua Taillon 2023-05-21 11:29:56 -06:00
parent cef28c52a2
commit 8637ecb203
7 changed files with 14 additions and 13 deletions

View File

@ -76,6 +76,7 @@ def user_1_raw_speed() -> User:
db.session.commit()
return user
@pytest.fixture()
def user_1_paris() -> User:
user = User(username='test', email='test@test.com', password='12345678')

View File

@ -54,8 +54,7 @@ class TestStoppedSpeedThreshold:
)
assert gpx_track_segment_mock.call_args_list[0] == call(
stopped_speed_threshold=expected_threshold,
raw=False
stopped_speed_threshold=expected_threshold, raw=False
)
gpx_track_segment_mock.assert_called_with(
expected_threshold, # stopped_speed_threshold
@ -89,8 +88,7 @@ class TestStoppedSpeedThreshold:
)
assert gpx_track_segment_mock.call_args_list[0] == call(
stopped_speed_threshold=expected_threshold,
raw=False
stopped_speed_threshold=expected_threshold, raw=False
)
gpx_track_segment_mock.assert_called_with(
expected_threshold, # stopped_speed_threshold

View File

@ -279,7 +279,11 @@ class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin):
assert_workout_data_with_gpx(data)
def test_it_adds_a_workout_with_gpx_file_raw_speed(
self, app: Flask, user_1_raw_speed: User, sport_1_cycling: Sport, gpx_file: str
self,
app: Flask,
user_1_raw_speed: User,
sport_1_cycling: Sport,
gpx_file: str,
) -> None:
client, auth_token = self.get_test_client_and_auth_token(
app, user_1_raw_speed.email
@ -301,7 +305,7 @@ class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin):
assert response.status_code == 201
assert 'created' in data['status']
assert len(data['data']['workouts']) == 1
# max speed should be slightly higher than that tested in
# max speed should be slightly higher than that tested in
# assert_workout_data_with_gpx
assert data['data']['workouts'][0]['max_speed'] == pytest.approx(5.25)

View File

@ -893,7 +893,7 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
:<json string language: language preferences
:<json boolean start_elevation_at_zero: do elevation plots start at zero?
:<json string timezone: user time zone
:<json boolean use_raw_gpx_speed: Use raw (unfiltered) gpx data to calculate speeds
:<json boolean use_raw_gpx_speed: Use unfiltered gpx to calculate speeds
:<json boolean weekm: does week start on Monday?
:reqheader Authorization: OAuth 2.0 Bearer Token

View File

@ -62,9 +62,7 @@ class User(BaseModel):
start_elevation_at_zero = db.Column(
db.Boolean, default=True, nullable=False
)
use_raw_gpx_speed = db.Column(
db.Boolean, default=False, nullable=False
)
use_raw_gpx_speed = db.Column(db.Boolean, default=False, nullable=False)
def __repr__(self) -> str:
return f'<User {self.username!r}>'

View File

@ -73,7 +73,7 @@ def get_gpx_info(
stopped_speed_threshold: float,
update_map_data: Optional[bool] = True,
update_weather_data: Optional[bool] = True,
use_raw_gpx_speed: Optional[bool] = False
use_raw_gpx_speed: Optional[bool] = False,
) -> Tuple:
"""
Parse and return gpx, map and weather data from gpx file
@ -130,7 +130,7 @@ def get_gpx_info(
map_data.append([point.longitude, point.latitude])
moving_data = segment.get_moving_data(
stopped_speed_threshold=stopped_speed_threshold,
raw=use_raw_gpx_speed
raw=use_raw_gpx_speed,
)
if moving_data:
calculated_max_speed = moving_data.max_speed

View File

@ -303,7 +303,7 @@ def process_one_gpx_file(
gpx_data, map_data, weather_data = get_gpx_info(
gpx_file=params['file_path'],
stopped_speed_threshold=stopped_speed_threshold,
use_raw_gpx_speed=auth_user.use_raw_gpx_speed
use_raw_gpx_speed=auth_user.use_raw_gpx_speed,
)
workout_date, _ = get_workout_datetime(
workout_date=gpx_data['start'],