From a4a22e6565dba9b62ac14cc9cc43519a363056c1 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 10 Dec 2025 14:25:42 +0900 Subject: [PATCH] fixup! WIP --- dibbler/models/Transaction.py | 18 +++++++----------- ...ducts_owned_by_user.py => user_products.py} | 0 2 files changed, 7 insertions(+), 11 deletions(-) rename dibbler/queries/{products_owned_by_user.py => user_products.py} (100%) diff --git a/dibbler/models/Transaction.py b/dibbler/models/Transaction.py index 7166588..853d210 100644 --- a/dibbler/models/Transaction.py +++ b/dibbler/models/Transaction.py @@ -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, diff --git a/dibbler/queries/products_owned_by_user.py b/dibbler/queries/user_products.py similarity index 100% rename from dibbler/queries/products_owned_by_user.py rename to dibbler/queries/user_products.py