feat: explain activity data quality
This commit is contained in:
@@ -86,7 +86,17 @@ def test_repeated_reports_from_one_player_do_not_add_unique_player_weight(db: Se
|
||||
|
||||
assert row.catches == 3
|
||||
assert row.unique_players == 1
|
||||
assert "3 свежих уловов от 1 игроков" in row.explanation
|
||||
assert "3 свежих улова от 1 игрока" in row.explanation
|
||||
|
||||
|
||||
def test_explanation_describes_low_data_and_confidence(db: Session) -> None:
|
||||
add_report(db, age_hours=2, player="Player", confidence=50)
|
||||
|
||||
row = activity_rows(db, hours=6, now=NOW)[0]
|
||||
|
||||
assert row.explanation.startswith("Низкая активность: 1 свежий улов от 1 игрока.")
|
||||
assert "Уверенность низкая." in row.explanation
|
||||
assert "Данных мало: нужно хотя бы 3 наблюдения." in row.explanation
|
||||
|
||||
|
||||
def test_pending_rejected_and_deleted_reports_are_excluded(db: Session) -> None:
|
||||
|
||||
@@ -46,11 +46,12 @@ def test_activity_filters_and_explains_score() -> None:
|
||||
assert len(payload) == 1
|
||||
assert payload[0]["catches"] == 3
|
||||
assert payload[0]["unique_players"] == 3
|
||||
assert "3 свежих уловов" in payload[0]["explanation"]
|
||||
assert "3 свежих улова" in payload[0]["explanation"]
|
||||
|
||||
|
||||
def test_invalid_period_is_rejected() -> None:
|
||||
assert client.get("/api/v1/activity?hours=13").status_code == 422
|
||||
assert client.get("/api/v1/activity?sort=unknown").status_code == 422
|
||||
|
||||
|
||||
def test_spot_detail_and_catches() -> None:
|
||||
|
||||
Reference in New Issue
Block a user