Overview
Part of #28 — Split GP Tracking feature.
Two changes to services/redis_updates.py (RedisLootTracker class):
- A new helper to increment (or decrement) a single player's score in a specific group leaderboard.
- Ensuring
force_update_player() re-applies split credits from the drop_splits table so that rebuilds don't erase earned GP for split participants.
Work Required
1. New method: add_split_credit()
def add_split_credit(self, player_id: int, split_value: int,
partition: int, group_id: int, world_type: str = "main") -> None:
prefix = "seasonal:" if world_type == "seasonal" else ""
key = f"{prefix}leaderboard:{partition}:group:{group_id}"
redis_client.client.zincrby(key, split_value, player_id)
- Called with a positive delta to credit a split participant.
- Called with a negative delta (e.g.
split_value - full_value) to reduce the receiver's group leaderboard score from full_value to split_value.
- Does not touch
player:*:total_loot keys or the global leaderboard.
2. Modify force_update_player()
After the existing per-partition rebuild loop (~line 384-399), add a step:
- Query
drop_splits where player_id = <player_being_rebuilt>.
- For each row, call
ZINCRBY leaderboard:{partition}:group:{group_id} +split_value <player_id> (only for groups with split_gp_tracking = 1, to avoid stale rows from before the flag was enabled).
- This ensures that when a split participant's Redis data is wiped and rebuilt, their earned group leaderboard credit is restored.
Notes
- The
force_update_player() function already accepts a DB session; pass it through to the new query.
- Only the group leaderboard sorted sets are touched — individual
total_loot keys remain receiver-only.
Overview
Part of #28 — Split GP Tracking feature.
Two changes to
services/redis_updates.py(RedisLootTrackerclass):force_update_player()re-applies split credits from thedrop_splitstable so that rebuilds don't erase earned GP for split participants.Work Required
1. New method:
add_split_credit()split_value - full_value) to reduce the receiver's group leaderboard score fromfull_valuetosplit_value.player:*:total_lootkeys or the global leaderboard.2. Modify
force_update_player()After the existing per-partition rebuild loop (~line 384-399), add a step:
drop_splitswhereplayer_id = <player_being_rebuilt>.ZINCRBY leaderboard:{partition}:group:{group_id} +split_value <player_id>(only for groups withsplit_gp_tracking = 1, to avoid stale rows from before the flag was enabled).Notes
force_update_player()function already accepts a DB session; pass it through to the new query.total_lootkeys remain receiver-only.