Skip to content

Commit

Permalink
Target goal total 3034 (#3035)
Browse files Browse the repository at this point in the history
* refactor: goal total calculation

* remove .bak files accidentially committed
  • Loading branch information
bdoherty committed Jan 28, 2023
1 parent 907007e commit f337420
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/extension/features/budget/display-target-goal-amount/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,20 @@ export class DisplayTargetGoalAmount extends Feature {

if (category) {
category.subCategories.forEach((subcategory) => {
if (subcategory.goalTargetAmount) {
categorySum += subcategory.goalTargetAmount;
if (subcategory.monthlySubCategoryBudgetCalculation) {
if (subcategory.monthlySubCategoryBudgetCalculation.isGoalValidForMonth) {
switch (subcategory.goalType) {
case ynab.constants.SubCategoryGoalType.TargetBalance:
categorySum += subcategory.goalTargetAmount || 0;
break;
case ynab.constants.SubCategoryGoalType.MonthlyFunding:
case ynab.constants.SubCategoryGoalType.Needed:
case ynab.constants.SubCategoryGoalType.TargetBalanceOnDate:
case ynab.constants.SubCategoryGoalType.DebtPayment:
categorySum += subcategory.monthlySubCategoryBudgetCalculation.goalTarget;
break;
}
}
}
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/extension/features/budget/goal-indicator/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
.tk-goal-indicator:last-child {
padding-right: 0.5em;
}

.is-master-category .tk-budget-table-cell-goal .tk-goal-sum-amount {
margin-right: 1.5em;
}
2 changes: 1 addition & 1 deletion src/extension/features/budget/utils.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
.tk-budget-table-cell-goal {
display: flex;
align-items: center;
font-size: 0.8em;
font-size: 0.8rem;
margin-left: auto;

width: 18%;
Expand Down

0 comments on commit f337420

Please sign in to comment.