Skip to content

Future: ultimatepoints as gamification layer on bbAccounts #3

@avandenberghe

Description

@avandenberghe

Context

dmzx/ultimatepoints currently handles both point storage and gamification (lottery, robbery, bonus) in a single extension with its own user_points column and points tables.

Long-term goal: gut ultimatepoints to only keep its gamification features (lottery, robbery, bonus) and have it depend on bbAccounts for all point storage and balance management.

Current UP Architecture

  • user_points column on phpbb_users — updated in-place
  • points_bank table — separate bank balances
  • points_log table — transaction log (but not source of truth)
  • points_values table — configuration
  • points_lottery_* tables — lottery state
  • Core functions: add_points(), substract_points() — direct UPDATE on user_points

Target Architecture

ultimatepoints (gamification only)
  └── depends on → bbAccounts (ledger)

What stays in UP:

  • Lottery module (ticket purchase, draw, jackpot)
  • Robbery module (attempt, success/fail, notifications)
  • Bonus module (random chance on activity)
  • Gamification-specific ACP settings
  • Gamification-specific permissions

What moves to bbAccounts:

  • All point storage → journal entries
  • All balance queries → ledger service get_subledger_balance()
  • Bank/savings → reclassification between liability control accounts
  • Transfers → reclassification + fee revenue
  • Transaction logs → subledger statement
  • Forum point earning → separate source module

How UP calls bbAccounts:

Lottery win (user avatharbe/bbAccounts-dev#42 wins 500 jackpot):

DR  5060 Lottery Expense           500.00
CR  2100 User Wallets — Cash       500.00  (subledger: user avatharbe/bbAccounts-dev#42)

Robbery success (user avatharbe/bbAccounts-dev#42 steals 50 from user #99):

DR  2100 User Wallets — Cash        50.00  (subledger: user #99)
CR  2100 User Wallets — Cash        50.00  (subledger: user avatharbe/bbAccounts-dev#42)

Ticket purchase (user avatharbe/bbAccounts-dev#42 buys ticket for 10):

DR  2100 User Wallets — Cash        10.00  (subledger: user avatharbe/bbAccounts-dev#42)
CR  4030 Lottery Ticket Revenue      10.00

Prerequisites

Open Questions

  • Fork UP or contribute upstream?
  • Data migration strategy for existing UP installations
  • Which UP version to base the rewrite on

Priority

This is a future milestone, not part of bbAccounts Phase 1. Tracked here for architectural alignment.

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