Overview
Part of #28 — Split GP Tracking feature.
A new table is needed to persist which players received split GP credit for a given drop within a given group. This is the source-of-truth that the Redis layer uses when force-rebuilding leaderboards.
Work Required
New file: db/models/drop_split.py
class DropSplit(Base):
__tablename__ = 'drop_splits'
id = Column(Integer, primary_key=True, autoincrement=True)
drop_id = Column(Integer, ForeignKey('drops.drop_id'), nullable=False, index=True)
player_id = Column(Integer, ForeignKey('players.player_id'), nullable=False, index=True)
group_id = Column(Integer, ForeignKey('groups.group_id'), nullable=False, index=True)
split_value = Column(Integer, nullable=False) # GP credited to this participant
date_added = Column(DateTime, default=func.now())
- Add
DropSplit import to db/models/__init__.py (follow the existing import pattern).
- Add a
CREATE TABLE IF NOT EXISTS drop_splits (...) statement to the DB initialisation script / Alembic migration so the table is created on startup.
Notes
player_id here is a split participant (non-receiver). The drop receiver is identified via drops.player_id.
split_value stores the per-participant GP credit (i.e. total_drop_value / num_participants).
- Only rows for groups that have
split_gp_tracking = 1 will ever be written here.
Overview
Part of #28 — Split GP Tracking feature.
A new table is needed to persist which players received split GP credit for a given drop within a given group. This is the source-of-truth that the Redis layer uses when force-rebuilding leaderboards.
Work Required
New file:
db/models/drop_split.pyDropSplitimport todb/models/__init__.py(follow the existing import pattern).CREATE TABLE IF NOT EXISTS drop_splits (...)statement to the DB initialisation script / Alembic migration so the table is created on startup.Notes
player_idhere is a split participant (non-receiver). The drop receiver is identified viadrops.player_id.split_valuestores the per-participant GP credit (i.e.total_drop_value / num_participants).split_gp_tracking = 1will ever be written here.