Skip to content

[Split Tracking] Update Discord "Modify Entry" context menu for split GP tracking #33

@joelhalen

Description

@joelhalen

Overview

Part of #28 — Split GP Tracking feature.

The existing "Modify Entry" Discord context menu (services/entry_modifier.py) allows group leaders to delete, hide, edit values, and modify splits on drop submissions. Each of these operations must now also maintain split GP credits in Redis and the drop_splits table when the affected group has split_gp_tracking enabled.

Work Required

File: services/entry_modifier.py

_handle_delete_confirm() — on drop deletion

Before committing the drop deletion:

  1. Query DropSplit rows for this drop_id.
  2. For each row, call redis_updates.add_split_credit(p.player_id, -split_value, partition, group_id) to remove the leaderboard credit.
  3. Also remove the receiver's negative adjustment: add_split_credit(receiver_id, full_value - split_value, partition, group_id) (restores to pre-split state before deletion wipes everything).
  4. Call _redis_force_update() for each unique split participant.
  5. Delete all DropSplit rows for this drop_id.

_handle_hide_toggle() — hide

Same as delete: remove leaderboard credits for all split participants, force-update them. Do not delete DropSplit rows (needed for unhide).

_handle_hide_toggle() — unhide

Re-apply split credits using existing DropSplit rows (they were preserved during hide).

_process_edit_value() (line 932)

After re-awarding points:

  1. Query existing DropSplit rows for the drop_id.
  2. Compute new_split_value = (new_value * drop.quantity) // len(participants).
  3. For each split participant: apply delta new_split_value - old_split_value via add_split_credit().
  4. For receiver: apply the net adjustment to the group leaderboard.
  5. Update DropSplit.split_value for each row.

_process_modify_splits() (line 988)

  1. Query old DropSplit rows.
  2. Reverse old split credits for all old participants; restore receiver's old adjustment.
  3. Delete old DropSplit rows.
  4. If new split list is non-empty and group has split_gp_tracking:
    • Create new DropSplit rows with recalculated split_value.
    • Apply new credits for new participants; apply new adjustment for receiver.
  5. Force-update Redis for all affected players (old + new participants).

Notes

  • _get_split_player_names() currently reads from PlayerPoints. After this change, it should also (or instead) read from DropSplit for GP-tracking purposes.
  • Use the existing _redis_force_update(player_id, db) helper for all force-update calls.
  • The group leaderboard partition can be derived from drop.date_added via get_current_partition() or drop.partition.

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