Files
EmailBill/openspec/specs/savings-plan-detail-view/spec.md
SunCheng a7414c792e
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 22s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
fix
2026-02-20 22:07:09 +08:00

2.8 KiB

MODIFIED Requirements

Requirement: Display income and expense budget in savings detail popup

The savings detail popup SHALL display the associated income budget and expense budget information for the selected savings plan, including both budget limits and current amounts.

Scenario: User opens savings detail popup with matched budgets

  • WHEN user clicks the detail button on a savings plan card
  • AND there exist income and expense budgets for the same period and type
  • THEN the popup SHALL display the income budget limit and current amount
  • AND the popup SHALL display the expense budget limit and current amount
  • AND the popup SHALL display the savings formula (Income Limit - Expense Limit = Planned Savings)
  • AND the popup SHALL display the savings result (Planned Savings, Actual Savings, Remaining)

Scenario: User opens savings detail popup without matched budgets

  • WHEN user clicks the detail button on a savings plan card
  • AND there are no income or expense budgets for the same period and type
  • THEN the popup SHALL display 0 for income budget limit and current amount
  • AND the popup SHALL display 0 for expense budget limit and current amount
  • AND the popup SHALL still display the savings formula and result with these values

Requirement: Pass budget data to savings component

The parent component (Index.vue) SHALL pass income budgets and expense budgets to the SavingsBudgetContent component to enable detail popup display.

Scenario: Budget data is loaded successfully

  • WHEN the budget data is loaded from the API
  • THEN the income budgets SHALL be passed to SavingsBudgetContent via props
  • AND the expense budgets SHALL be passed to SavingsBudgetContent via props
  • AND the savings budgets SHALL be passed to SavingsBudgetContent via props (existing behavior)

Requirement: Match income and expense budgets to savings plan

The SavingsBudgetContent component SHALL match income and expense budgets to the current savings plan based on periodStart and type fields.

Scenario: Match budgets with same period and type

  • WHEN displaying savings plan details
  • AND the component searches for matching budgets
  • THEN the component SHALL find income budgets where periodStart and type match the savings plan
  • AND the component SHALL find expense budgets where periodStart and type match the savings plan
  • AND if multiple matches exist, the component SHALL use the first match

Scenario: No matching budgets found

  • WHEN displaying savings plan details
  • AND no income budget matches the savings plan's periodStart and type
  • OR no expense budget matches the savings plan's periodStart and type
  • THEN the component SHALL use 0 as the default value for unmatched budget fields
  • AND the popup SHALL still render without errors