fixup! WIP

This commit is contained in:
2025-12-10 14:25:42 +09:00
parent bb7d1a2743
commit a4a22e6565
2 changed files with 7 additions and 11 deletions

View File

@@ -34,17 +34,11 @@ if TYPE_CHECKING:
from .User import User
# TODO: rename to *_PERCENT
# NOTE: these only matter when there are no adjustments made in the database.
DEFAULT_INTEREST_RATE_PERCENTAGE = 100
DEFAULT_PENALTY_THRESHOLD = -100
DEFAULT_PENALTY_MULTIPLIER_PERCENTAGE = 200
# TODO: allow for joint transactions?
# dibbler allows joint transactions (e.g. buying more than one product at once, several people buying the same product, etc.)
# instead of having the software split the transactions up, making them hard to reconnect,
# maybe we should add some sort of joint transaction id field to allow multiple transactions to be grouped together?
_DYNAMIC_FIELDS: set[str] = {
"amount",
"interest_rate_percent",
@@ -277,11 +271,6 @@ class Transaction(Base):
See also `penalty_threshold`.
"""
# TODO: this should be inferred
# Assuming this is a BUY_PRODUCT transaction, was the user penalized for having
# too low credit in this transaction?
# is_penalized: Mapped[Boolean] = mapped_column(Boolean, default=False)
interest_rate_percent: Mapped[int | None] = mapped_column(Integer, nullable=True)
"""
On `ADJUST_INTEREST` transactions, this is the interest rate in percent
@@ -291,6 +280,13 @@ class Transaction(Base):
price of the product, `200` means they have to pay double, etc.
"""
economy_spec_version: Mapped[int] = mapped_column(Integer, default=1)
"""
The version of the economy specification that this transaction adheres to.
This is used to handle changes in the economy rules over time.
"""
def __init__(
self: Self,
type_: TransactionType,