Skip to content

[Split Tracking] Add drop_splits database table and ORM model #29

@joelhalen

Description

@joelhalen

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.

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