Skip to content

Future: bbDKP point storage on bbAccounts ledger #4

@avandenberghe

Description

@avandenberghe

Context

avatharbe/bbDKP currently stores DKP points in fixed-column tables (memberdkp, adjustments) inherited from EQDKP. This was identified as fundamentally flawed in avatharbe/bbDKP#1 — the original issue that inspired bbAccounts.

Long-term goal: replace bbDKP's point storage with bbAccounts journal entries. bbDKP keeps raid management, item tracking, and game-specific features; bbAccounts owns the ledger.

Current bbDKP Architecture

  • memberdkp table — one row per member per DKP pool, columns for each point type (member_earned, member_spent, member_adjustment, member_time_bonus, etc.)
  • adjustments table — manual point corrections
  • items table — loot distribution records (stays)
  • raids / raiddetail tables — raid events and attendance (stays)
  • Balance = earned − spent + adjustments (computed from columns, not transactions)

Problems (from bbDKP#1)

  • New point type = new column
  • Deleting a raid requires recalculating every participant's earned total
  • No per-raid breakdown of time-based earnings (join/leave time varies per member)
  • No audit trail of individual point mutations

Target Architecture

bbDKP (raid management, items, game integration)
  └── depends on → bbAccounts (ledger)

What stays in bbDKP:

  • Raid creation/management
  • Raid attendance tracking
  • Item/loot distribution
  • Game-specific modules (WoW, FFXIV, etc.)
  • DKP pool configuration

What moves to bbAccounts:

  • All point storage → journal entries
  • All balance queries → subledger balances
  • Adjustments → manual journal entries

How bbDKP calls bbAccounts:

Raid earned (member avatharbe/bbAccounts-dev#42 earns 10 DKP for raid attendance):

DR  5100 DKP Earned — Raids        10.00
CR  2300 Member DKP Balance         10.00  (subledger: user avatharbe/bbAccounts-dev#42)

Item purchased (member avatharbe/bbAccounts-dev#42 spends 25 DKP on item):

DR  2300 Member DKP Balance         25.00  (subledger: user avatharbe/bbAccounts-dev#42)
CR  4100 DKP Spent — Items          25.00

Time bonus (member avatharbe/bbAccounts-dev#42, based on raid duration):

DR  5110 DKP Earned — Time Bonus    3.50
CR  2300 Member DKP Balance          3.50  (subledger: user avatharbe/bbAccounts-dev#42)

Manual adjustment:

DR  5120 DKP Adjustments           15.00
CR  2300 Member DKP Balance         15.00  (subledger: user avatharbe/bbAccounts-dev#42)

Deleting a raid = reversing entry for every participant's original earned entry. Clean, auditable, no recalculation needed.

EP/GP ratio = derived from SELECT SUM(debit), SUM(credit) on the relevant accounts, filtered by subledger_user_id.

Multiple DKP Pools

Each DKP pool could map to its own set of subledger control accounts (e.g., 2300 Pool A — Member Balance, 2310 Pool B — Member Balance), or use a dimension/tag on journal lines. TBD.

Prerequisites

Priority

Future milestone. Tracked here for architectural alignment — this is the original use case that inspired the whole system.

Tasks

Decomposition deferred until Phase 2 closes. The Phase 3 plan will be drafted after #2 (point-sources architectural decision) lands; that decision shapes the source-adapter interface every Phase 3 task will build on.

  • (to be filed once Phase 3 is planned — contrib/plans/ will get a bbaccounts-phase3-plan.md)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions