Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Average Heartrate Tickvals Issue #24

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def get_scatter_plot(
for i in range(
min(start_timestamps),
max(start_timestamps),
(max(start_timestamps) - min(start_timestamps)) // 5,
# The outter max is stopping this from going below 1, which can happen in cases of very few activities.
max(1, (max(start_timestamps) - min(start_timestamps)) // 5),
)
]
ticktext = [dt.datetime.fromtimestamp(i).strftime("%d/%m/%Y") for i in tickvals]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

from active_statistics.exceptions import UserVisibleException
from active_statistics.statistics.plots.average_heartrate_by_average_speed import plot
from tests.factories.activity_factories import ActivityFactory


def test_average_heartrate_by_average_speed_animation(
some_basic_runs_and_rides,
) -> None:
def test_average_heartrate_by_average_speed_plot(some_basic_runs_and_rides) -> None:
plot(some_basic_runs_and_rides)


def test_no_data(no_activities_at_all) -> None:
with pytest.raises(UserVisibleException):
plot(no_activities_at_all)


def test_average_heartrate_by_average_speed_few_activities() -> None:
activities = [ActivityFactory(), ActivityFactory()]
plot(_ for _ in activities)