Add running personal records and historical PR badges

This commit is contained in:
Peter Stockings
2026-10-02 13:52:27 +10:00
parent b902ec6312
commit a82135bc89
10 changed files with 240 additions and 9 deletions
+21 -1
View File
@@ -86,12 +86,32 @@ def test_owner_dashboard_activity_json_and_settings_render(app):
assert "point" not in data["chart"][0]
def test_personal_records_render_and_remain_owner_only(app):
with app.app_context():
row = db.session.get(Activity, 1)
row.samples = [{"distance": 0, "time": 0}, {"distance": 5000, "time": 1500}]
row.share_token = "record-test"
db.session.commit()
client = app.test_client()
login(client)
dashboard = client.get("/dashboard").data
assert b"Personal records" in dashboard
assert b"5 km PR" in dashboard
detail = client.get("/activities/1").data
assert b"Best efforts on this run" in detail
assert b"5 km" in detail
assert b"Best efforts on this run" not in client.get("/shared/runs/record-test").data
client.post("/logout")
login(client, "other")
assert b"5 km PR" not in client.get("/dashboard").data
def test_dashboard_replays_latest_accessible_gps_run(app):
client = app.test_client()
login(client)
page = client.get("/dashboard").data
assert b'id="dashboard-route-map" data-url="/activities/1/data"' in page
assert b'id="toggle-route-replay"' in page
assert b'id="toggle-route-replay"' not in page
assert b'vendor/leaflet.js' in page
assert b'class="dashboard-map"' not in page
client.post("/logout")