Skip to content

[Split Tracking] Modify submission pipeline to write split records and adjust group leaderboard #31

@joelhalen

Description

@joelhalen

Overview

Part of #28 — Split GP Tracking feature.

When a drop is submitted with players_included for a group that has split_gp_tracking enabled, the pipeline must:

  1. Persist split credit records to drop_splits.
  2. Adjust the group leaderboard in Redis so each participant (including receiver) receives an equal share of the GP value.

Work Required

File: data/submissions/drop.pydrop_processor()

Insert after the existing group config loading block (~line 320, after player_groups is resolved and group configs are fetched):

For each group in player_groups:

  1. Check if split_gp_tracking config is "1" for this group.
  2. If enabled and players_included is non-empty:
    a. Resolve each name in players_included to a Player row (query by player_name).
    b. Filter to players who are valid members of this group — reuse check_split_capability() from data/submissions/point_awards.py.
    c. Build participants = [receiver] + [valid split players].
    d. split_value = (drop.value * drop.quantity) // len(participants).
    e. For each non-receiver participant:
    • Create a DropSplit(drop_id=drop.drop_id, player_id=p.player_id, group_id=group.group_id, split_value=split_value) and flush.
    • Call redis_updates.add_split_credit(p.player_id, split_value, partition, group.group_id, world_type).
      f. Adjust the receiver's group leaderboard score: call redis_updates.add_split_credit(receiver_id, split_value - full_value, partition, group.group_id, world_type). This is a negative delta that brings the receiver from full_value down to split_value on the group board only — the global leaderboard and player:*:total_loot keys are untouched.

Key Constraints

  • The global individual leaderboard and player:{id}:{partition}:total_loot Redis keys are never modified here — only leaderboard:{partition}:group:{group_id} sorted sets.
  • Groups without split_gp_tracking are unaffected; no DropSplit rows are written.
  • players_included is already normalised at line 110 via _normalize_incoming_players(); use that result directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions