feat(gamification): expand badge tiers and count only outgoing likes
This commit is contained in:
@@ -26,7 +26,12 @@ def test_authenticated_summary_returns_progress_and_activity_breakdown(client, u
|
||||
assert summary["activity_counts"]["attendance"] == 1
|
||||
assert "attendance-1" in {badge["id"] for badge in summary["badges"]}
|
||||
assert summary["points_per_activity"] == {"attendance": 30, "post": 20, "comment": 5, "like": 1, "save": 1}
|
||||
assert summary["badge_thresholds"]["likes"] == [10, 50, 100]
|
||||
assert summary["badge_thresholds"] == {
|
||||
"attendance": [1, 5, 10, 25],
|
||||
"posts": [1, 5, 10, 25],
|
||||
"comments": [1, 5, 20, 50],
|
||||
"likes": [1, 10, 50, 100],
|
||||
}
|
||||
|
||||
|
||||
def test_public_profile_exposes_badges_but_never_points_even_when_details_are_hidden(
|
||||
|
||||
@@ -30,7 +30,8 @@ def test_publish_coauthor_like_and_save_award_expected_contributions(user_factor
|
||||
assert summary_for_user(coauthor)["points_total"] == 22
|
||||
assert summary_for_user(actor)["points_total"] == 2
|
||||
assert summary_for_user(actor)["activity_counts"]["likes"] == 1
|
||||
assert summary_for_user(coauthor)["activity_counts"]["likes"] == 1
|
||||
assert summary_for_user(author)["activity_counts"]["likes"] == 0
|
||||
assert summary_for_user(coauthor)["activity_counts"]["likes"] == 0
|
||||
|
||||
post.writers.remove(coauthor)
|
||||
post.writers.remove(author)
|
||||
|
||||
@@ -44,11 +44,22 @@ def test_highest_level_has_no_next_level_or_remaining_progress():
|
||||
def test_earned_badges_include_every_reached_global_and_activity_milestone():
|
||||
badges = earned_badges(
|
||||
total_points=300,
|
||||
activity_counts={"attendance": 5, "posts": 1, "comments": 4, "likes": 50},
|
||||
activity_counts={"attendance": 5, "posts": 25, "comments": 4, "likes": 50},
|
||||
)
|
||||
badge_ids = {badge["id"] for badge in badges}
|
||||
|
||||
assert {"level-companion", "level-contributor", "level-ally"} <= badge_ids
|
||||
assert {"attendance-1", "attendance-5", "post-1", "likes-10", "likes-50"} <= badge_ids
|
||||
assert {
|
||||
"attendance-1",
|
||||
"attendance-5",
|
||||
"post-1",
|
||||
"post-5",
|
||||
"post-10",
|
||||
"post-25",
|
||||
"comment-1",
|
||||
"likes-1",
|
||||
"likes-10",
|
||||
"likes-50",
|
||||
} <= badge_ids
|
||||
assert "comment-5" not in badge_ids
|
||||
assert not any(badge_id.startswith("save-") for badge_id in badge_ids)
|
||||
|
||||
Reference in New Issue
Block a user