cleanup of billing/costcenter pr

This commit is contained in:
behrinml
2026-07-30 22:36:39 +02:00
parent 449060ce0a
commit dae96f2cd3
4 changed files with 11 additions and 13 deletions
+4 -8
View File
@@ -1214,22 +1214,18 @@ async def _migrate_create_finance_indexes(conn) -> None:
"CREATE INDEX IF NOT EXISTS ix_cost_center_invitations_email ON cost_center_invitations (email)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_user_id ON wallet_transactions (user_id)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_cost_center_id ON wallet_transactions (cost_center_id)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_transaction_type "
"ON wallet_transactions (transaction_type)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_transaction_type ON wallet_transactions (transaction_type)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_created_by_user_id "
"ON wallet_transactions (created_by_user_id)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_print_run_id ON wallet_transactions (print_run_id)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_print_archive_id "
"ON wallet_transactions (print_archive_id)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_print_archive_id ON wallet_transactions (print_archive_id)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_print_queue_id ON wallet_transactions (print_queue_id)",
"CREATE INDEX IF NOT EXISTS ix_wallet_transactions_created_at ON wallet_transactions (created_at)",
"CREATE INDEX IF NOT EXISTS ix_budget_reservations_cost_center_id "
"ON budget_reservations (cost_center_id)",
"CREATE INDEX IF NOT EXISTS ix_budget_reservations_cost_center_id ON budget_reservations (cost_center_id)",
"CREATE INDEX IF NOT EXISTS ix_budget_reservations_status ON budget_reservations (status)",
"CREATE INDEX IF NOT EXISTS ix_budget_reservations_source_type ON budget_reservations (source_type)",
"CREATE INDEX IF NOT EXISTS ix_budget_reservations_source_id ON budget_reservations (source_id)",
"CREATE INDEX IF NOT EXISTS ix_budget_reservations_print_archive_id "
"ON budget_reservations (print_archive_id)",
"CREATE INDEX IF NOT EXISTS ix_budget_reservations_print_archive_id ON budget_reservations (print_archive_id)",
]
for statement in indexes:
await _safe_execute(conn, statement)
@@ -86,7 +86,9 @@ async def test_postgres_finance_ddl_uses_postgres_types():
assert all("id SERIAL PRIMARY KEY" in sql for sql in create_statements)
assert "TIMESTAMP" in "\n".join(create_statements)
created_tables = {sql.split("CREATE TABLE IF NOT EXISTS", 1)[1].split("(", 1)[0].strip() for sql in create_statements}
created_tables = {
sql.split("CREATE TABLE IF NOT EXISTS", 1)[1].split("(", 1)[0].strip() for sql in create_statements
}
assert created_tables == EXPECTED_TABLES
@@ -303,7 +303,7 @@ describe('SettingsPage', () => {
expect(localStorage.setItem).toHaveBeenCalledWith(
SIDEBAR_ORDER_KEY,
JSON.stringify(['ext-7', 'printers', 'inventory', 'archives', 'queue', 'projects', 'files', 'makerworld', 'profiles', 'maintenance', 'stats', 'notifications', 'settings']),
JSON.stringify(['ext-7', 'printers', 'inventory', 'archives', 'queue', 'projects', 'finance', 'files', 'makerworld', 'profiles', 'maintenance', 'stats', 'notifications', 'settings']),
);
});
@@ -345,7 +345,7 @@ describe('SettingsPage', () => {
expect(localStorage.setItem).toHaveBeenCalledWith(SIDEBAR_HIDDEN_SYSTEM_ITEMS_KEY, JSON.stringify([]));
expect(localStorage.setItem).toHaveBeenCalledWith(
SIDEBAR_ORDER_KEY,
JSON.stringify(['printers', 'inventory', 'archives', 'queue', 'projects', 'files', 'makerworld', 'profiles', 'maintenance', 'stats', 'notifications', 'settings', 'ext-7']),
JSON.stringify(['printers', 'inventory', 'archives', 'queue', 'projects', 'finance', 'files', 'makerworld', 'profiles', 'maintenance', 'stats', 'notifications', 'settings', 'ext-7']),
);
const settingsRow = screen.getAllByText('Settings')
@@ -411,6 +411,7 @@ describe('SettingsPage', () => {
'archives',
'queue',
'projects',
'finance',
'files',
'makerworld',
'profiles',
+1 -2
View File
@@ -1032,8 +1032,7 @@ export function SettingsPage() {
(settings.bed_temp_presets ?? '') !== (localSettings.bed_temp_presets ?? '') ||
(settings.chamber_temp_presets ?? '') !== (localSettings.chamber_temp_presets ?? '') ||
(settings.fan_speed_presets ?? '') !== (localSettings.fan_speed_presets ?? '') ||
(settings.session_max_hours ?? 24) !== (localSettings.session_max_hours ?? 24);
(settings.require_plate_clear ?? false) !== (localSettings.require_plate_clear ?? false) ||
(settings.session_max_hours ?? 24) !== (localSettings.session_max_hours ?? 24) ||
(settings.billing_enabled ?? false) !== (localSettings.billing_enabled ?? false) ||
(settings.printer_kill_switch_enabled ?? false) !== (localSettings.printer_kill_switch_enabled ?? false) ||
(settings.finance_budget_reset_day ?? 1) !== (localSettings.finance_budget_reset_day ?? 1) ||