mirror of
https://git.hiabuto.net/C3MA/CCMA.git
synced 2026-08-24 22:45:18 +02:00
Fix reminder dialog sizing, item editing, and old-repo fee defaults
The dialog's base class sets resizable(False, False) before this subclass's content (including the preset-populated items table) exists, so its initial size stayed locked to a too-small guess and cut off the bottom. It now explicitly sizes to its actual content after everything, including the selected preset's items, has been built. The items table only supported add/remove -- there was no way to change an already-added row's amount (e.g. after picking the Rücklastschrift preset, its prefilled fee couldn't be adjusted). Selecting a row now loads it into the description/amount fields, and a new "Aktualisieren" button applies edits back to that row. The Rücklastschrift preset label was missing the "Stufe N:" prefix the other presets have, inconsistent for no reason. Also fixed a real gap: repositories created before standard_fee_items existed had no such key in repository.json at all, so Optionen showed an empty Standardpositionen table instead of the built-in defaults. get_reminder_policy() now backfills the defaults when the key is missing entirely, while still respecting a list the board intentionally emptied and saved. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
a1719cad5e
commit
d4dfd0066a
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
from datetime import date, timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
@@ -278,3 +279,25 @@ def test_reminder_policy_rejects_invalid_input(tmp_path) -> None:
|
||||
levels=[{"name": "Mahnung", "fee": "-1.00", "payment_deadline_days": 14}],
|
||||
standard_fee_items=[],
|
||||
)
|
||||
|
||||
|
||||
def test_reminder_policy_backfills_standard_fee_items_for_old_repositories(tmp_path) -> None:
|
||||
repository = MemberRepository(tmp_path)
|
||||
repository.initialize()
|
||||
config_path = tmp_path / "repository.json"
|
||||
raw = json.loads(config_path.read_text(encoding="utf-8"))
|
||||
# Simulate a repository created before "standard_fee_items" existed at all.
|
||||
del raw["reminder_policy"]["standard_fee_items"]
|
||||
config_path.write_text(json.dumps(raw), encoding="utf-8")
|
||||
|
||||
policy = repository.get_reminder_policy()
|
||||
assert policy["standard_fee_items"], "should fall back to built-in defaults"
|
||||
assert any(item["description"] == "Rücklastschriftgebühr" for item in policy["standard_fee_items"])
|
||||
|
||||
# But once the board explicitly saves an empty list, that choice is respected.
|
||||
repository.save_reminder_policy(
|
||||
grace_days_after_due=policy["grace_days_after_due"],
|
||||
levels=policy["levels"],
|
||||
standard_fee_items=[],
|
||||
)
|
||||
assert repository.get_reminder_policy()["standard_fee_items"] == []
|
||||
|
||||
Reference in New Issue
Block a user