Section groups with collapsible headers + Sinking Funds #12

Merged
claude-code merged 4 commits from feat/11-groups-and-sinks into main 2026-04-17 12:46:04 -06:00
2 changed files with 49 additions and 0 deletions
Showing only changes of commit 032c35c75e - Show all commits

View file

@ -0,0 +1,47 @@
from __future__ import annotations
import enum
from quartermaster.models import Section
class Group(str, enum.Enum):
income = "income"
committed = "committed"
savings = "savings"
flexible = "flexible"
GROUP_LABELS: dict[Group, str] = {
Group.income: "Income",
Group.committed: "Committed",
Group.savings: "Savings",
Group.flexible: "Flexible",
}
GROUP_OF_SECTION: dict[Section, Group] = {
Section.income: Group.income,
Section.fixed_bill: Group.committed,
Section.debt_minimum: Group.committed,
Section.sinking_fund: Group.savings,
Section.food: Group.flexible,
Section.subscription: Group.flexible,
Section.other: Group.flexible,
}
GROUP_DEFAULT_OPEN: dict[Group, bool] = {
Group.income: True,
Group.committed: False,
Group.savings: False,
Group.flexible: True,
}
def sections_in_group(group: Group) -> list[Section]:
return [s for s in Section if GROUP_OF_SECTION[s] == group]
def group_order() -> list[Group]:
return [Group.income, Group.committed, Group.savings, Group.flexible]

View file

@ -24,6 +24,7 @@ class Section(str, enum.Enum):
food = "food" food = "food"
subscription = "subscription" subscription = "subscription"
other = "other" other = "other"
sinking_fund = "sinking_fund"
SECTION_LABELS: dict[Section, str] = { SECTION_LABELS: dict[Section, str] = {
@ -33,6 +34,7 @@ SECTION_LABELS: dict[Section, str] = {
Section.food: "Food and Essentials", Section.food: "Food and Essentials",
Section.subscription: "Subscriptions", Section.subscription: "Subscriptions",
Section.other: "Other", Section.other: "Other",
Section.sinking_fund: "Sinking Funds",
} }