Replace fixed DSL fields with parameterized metric expressions
This commit is contained in:
@@ -128,7 +128,7 @@ def test_daily_windows_include_rest_days_and_prior_history(app):
|
||||
add_run("2026-09-03", 5000)
|
||||
db.session.commit()
|
||||
q = parsed("days\nduring 2026-09-02 to 2026-09-09\n"
|
||||
"summarize latest(rolling_7d_distance), latest(run_day_streak), latest(days_since_long_run)\n"
|
||||
"summarize latest(rolling_sum(distance, 7 days)), latest(run_day_streak), latest(days_since_run(distance >= 10 km))\n"
|
||||
"by day\ncompare none")
|
||||
result = explore(1, "UTC", q)
|
||||
assert len(result["groups"]) == 8
|
||||
@@ -137,7 +137,7 @@ def test_daily_windows_include_rest_days_and_prior_history(app):
|
||||
assert result["cards"][0]["value"] == "5.0"
|
||||
assert result["rows"][0]["id"] is None
|
||||
assert result["coverage"]["sessions"] == 2
|
||||
q["long_run"] = 20
|
||||
q = parsed(query_text(q).replace("distance >= 10 km", "distance >= 20 km"))
|
||||
assert explore(1, "UTC", q)["cards"][-1]["value"] == "—"
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ def test_efforts_and_performance_metrics_preserve_missing_distances(app):
|
||||
result = explore(1, "UTC", q)
|
||||
assert result["cards"][0]["value"] == "30:00"
|
||||
assert result["rows"][0]["id"] == 1
|
||||
q = parsed("runs\nduring all time\nsummarize min(best_5km), min(best_10km)\nby month\ncompare none")
|
||||
q = parsed("runs\nduring all time\nsummarize min(best_time(5 km)), min(best_time(10 km))\nby month\ncompare none")
|
||||
assert [c["value"] for c in explore(1, "UTC", q)["cards"]] == ["30:00", "—"]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user