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:
- Query
DropSplit rows for this drop_id.
- For each row, call
redis_updates.add_split_credit(p.player_id, -split_value, partition, group_id) to remove the leaderboard credit.
- 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).
- Call
_redis_force_update() for each unique split participant.
- 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:
- Query existing
DropSplit rows for the drop_id.
- Compute
new_split_value = (new_value * drop.quantity) // len(participants).
- For each split participant: apply delta
new_split_value - old_split_value via add_split_credit().
- For receiver: apply the net adjustment to the group leaderboard.
- Update
DropSplit.split_value for each row.
_process_modify_splits() (line 988)
- Query old
DropSplit rows.
- Reverse old split credits for all old participants; restore receiver's old adjustment.
- Delete old
DropSplit rows.
- 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.
- 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.
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 thedrop_splitstable when the affected group hassplit_gp_trackingenabled.Work Required
File:
services/entry_modifier.py_handle_delete_confirm()— on drop deletionBefore committing the drop deletion:
DropSplitrows for thisdrop_id.redis_updates.add_split_credit(p.player_id, -split_value, partition, group_id)to remove the leaderboard credit.add_split_credit(receiver_id, full_value - split_value, partition, group_id)(restores to pre-split state before deletion wipes everything)._redis_force_update()for each unique split participant.DropSplitrows for thisdrop_id._handle_hide_toggle()— hideSame as delete: remove leaderboard credits for all split participants, force-update them. Do not delete
DropSplitrows (needed for unhide)._handle_hide_toggle()— unhideRe-apply split credits using existing
DropSplitrows (they were preserved during hide)._process_edit_value()(line 932)After re-awarding points:
DropSplitrows for thedrop_id.new_split_value = (new_value * drop.quantity) // len(participants).new_split_value - old_split_valueviaadd_split_credit().DropSplit.split_valuefor each row._process_modify_splits()(line 988)DropSplitrows.DropSplitrows.split_gp_tracking:DropSplitrows with recalculatedsplit_value.Notes
_get_split_player_names()currently reads fromPlayerPoints. After this change, it should also (or instead) read fromDropSplitfor GP-tracking purposes._redis_force_update(player_id, db)helper for all force-update calls.drop.date_addedviaget_current_partition()ordrop.partition.