fix(analysis): address the two review nits
The re-review returned APPROVED with two low-severity notes. - The prose said "Across 15 finished brews", which reads as though there are only 15 brews. It now says "Across 15 of 16 finished brews", so the exclusion is visible in the sentence itself and not only in the card header. - `/api/runs/<run_id>` did not carry the `suspect` flag that `/api/runs` does, so a consumer of the detail endpoint could not tell an impossible run from a good one. It does now, with a test. 134 tests.
This commit is contained in:
@@ -184,7 +184,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card__body">
|
<div class="card__body">
|
||||||
<p>
|
<p>
|
||||||
Across {{ stats.trusted_count }} finished brews the attenuation averages
|
Across {% if stats.suspect_count %}{{ stats.trusted_count }} of {{ stats.count }}{% else %}{{ stats.count }}{% endif %} finished brews the attenuation averages
|
||||||
<strong>{{ stats.consistency.mean }}%</strong>, with a standard
|
<strong>{{ stats.consistency.mean }}%</strong>, with a standard
|
||||||
deviation of <strong>{{ stats.consistency.stdev }} percentage
|
deviation of <strong>{{ stats.consistency.stdev }} percentage
|
||||||
points</strong> and a total range of {{ stats.consistency.spread }}
|
points</strong> and a total range of {{ stats.consistency.spread }}
|
||||||
|
|||||||
@@ -208,6 +208,9 @@ def api_run(run_id: str):
|
|||||||
summary = run_summary(run, og_override=meta.get("og_points"))
|
summary = run_summary(run, og_override=meta.get("og_points"))
|
||||||
summary["canonical_name"] = meta.get("name") or run.display_name()
|
summary["canonical_name"] = meta.get("name") or run.display_name()
|
||||||
summary["tap_number"] = meta.get("tap_number")
|
summary["tap_number"] = meta.get("tap_number")
|
||||||
|
# The same flag the list endpoint carries, so a consumer of the detail
|
||||||
|
# endpoint can tell an impossible run from a good one.
|
||||||
|
summary["suspect"] = bool(implausible_runs([run]))
|
||||||
return jsonify(summary)
|
return jsonify(summary)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -361,6 +361,23 @@ def test_a_suspect_run_is_not_the_strongest_brew_in_the_history(logged_in, repo)
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_run_detail_api_also_flags_a_suspect_run(logged_in, repo):
|
||||||
|
"""The detail endpoint carries the same flag as the list endpoint.
|
||||||
|
|
||||||
|
A consumer of /api/runs/<run_id> must be able to tell an impossible
|
||||||
|
run from a good one.
|
||||||
|
"""
|
||||||
|
_two_runs(repo)
|
||||||
|
|
||||||
|
response = logged_in.get("/api/runs/12")
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.get_json()["suspect"] is True
|
||||||
|
|
||||||
|
response = logged_in.get("/api/runs/1")
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.get_json()["suspect"] is False
|
||||||
|
|
||||||
|
|
||||||
def test_the_charts_skip_suspect_runs():
|
def test_the_charts_skip_suspect_runs():
|
||||||
"""The chart script must leave the suspect runs out.
|
"""The chart script must leave the suspect runs out.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user