Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Custom Average Month Quick Budget isn't working #2821

Closed
rhyser9 opened this issue Jun 30, 2022 · 9 comments · Fixed by #2842 or #2975
Closed

[BUG] Custom Average Month Quick Budget isn't working #2821

rhyser9 opened this issue Jun 30, 2022 · 9 comments · Fixed by #2842 or #2975
Labels
bug Something isn't working

Comments

@rhyser9
Copy link

rhyser9 commented Jun 30, 2022

Describe the bug
Enabled the "Add Custom Average Month Quick Budget" option introduced in v3.3.0 via #2738. Almost no part of the feature appears to work as expected. This may be due to interaction with other settings I have configured, I have not tested a default settings template.

When a category is underfunded, the "Average Spent (X Mo.)" button appears towards the top of the list, directly under the underfunded button. When the category is not underfunded (thus the underfunded button does not exist), the "Average Spent (X Mo.)" button appears towards the bottom of the list, under the default "Average Spent" button.

The 6 month and 12 month options always show "$0.00" and do nothing when clicked.

The 3 month option shows the average spent is -$13.93 (for example), whereas the default average spent option shows a positive number. When clicked while the category's assigned amount is $0, it sets the category to -$13.93, and the parent group then equals -$25.000.013.93. When clicked while the category's assigned amount is $10.00, the assigned amount is set to -$1,000.013.93 and the parent group then equals -$250,001,000,013.93. This also causes YNAB to crash and present the error "Uh-oh! Something has gone wrong likely having to do with internets and tubes...."

On one category, the 3mo avg is -$80.29. The last 6 months of spending (including the current month) are:
January = -$82.84 February = -$82.80 March = -$76.11 April = -$75.60 May = -$58.29 June = -$63.76
The 3 month average does not align with any of these values. The closest is the average for January through March. Other categories exhibit the same behavior, where the 3mo average doesn't appear to be the average of ANY 3 month period.

Continuing the above example, adding a $100 uncleared, cleared, and/or reconciled outflow to the category for the current month results in no change to the 3mo average, even after a hard reload. Adding a $100 uncleared transaction to the category for the previous month causes the 3mo average to increase by $33.33 (as expected). Deleting the uncleared transaction does not cause the 3mo average to decrease, even after a hard reload, clearing browser cookies, or changing to the 6mo/12mo options and then back to the 3mo option.

Expected behavior

  1. "Average Spent (X Mo.)" button should always appear under the default "Average Spent" button, regardless of the actual order of buttons in the Auto-Assign panel.
  2. The 6mo and 12mo average should not show $0.00 and should do something when clicked.
  3. The average spent should display a positive value consistent with the default "Average Spent" option.
  4. The average spent should show the true average spent for the previous 3 months (whether that be last 2 plus current, or previous 3 excluding current).
  5. Clicking the average spent button should assign a positive value to the category, and should not crash YNAB / assign negative 25 million / 250 billion when clicked.
  6. Deleting a transaction should cause the average spent to decrease, especially without having to reload the page

Screenshots
6 month setting, underfunded category
image

6 month setting, not underfunded category
image

3 month setting, $0.00 assigned to category before clicking "Average Spent (3 Mo.)"
image

3 month setting, $10.00 assigned to category before clicking "Average Spent (3 Mo.)"
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Microsoft Edge Version 103.0.1264.37 (Official build) (64-bit)
  • Toolkit Version: 3.3.0

Setting Export

[{"key":"AccountsDisplayDensity","value":"1"},{"key":"AccountsEmphasizedInflows","value":true},{"key":"AccountsEmphasizedOutflows","value":false},{"key":"AccountsStripedRows","value":true},{"key":"AccountsStripedRowsColor","value":"#f7f7f7"},{"key":"AccountsStripedRowsDarkColor","value":"#1e1e1f"},{"key":"AssistedClear","value":false},{"key":"AutoDistributeSplits","value":true},{"key":"AutoEnableRunningBalance","value":false},{"key":"AutomaticallyMarkAsCleared","value":false},{"key":"BetterScrollbars","value":false},{"key":"BottomNotificationBar","value":true},{"key":"BudgetCategoryFeatures","value":true},{"key":"BudgetProgressBars","value":false},{"key":"BudgetQuickSwitch","value":true},{"key":"BudgetSpendingGoal","value":true},{"key":"BulkEditMemo","value":true},{"key":"BulkManagePayees","value":true},{"key":"CalculateIRR","value":"Purple"},{"key":"CalendarFirstDay","value":false},{"key":"CategoryActivityCopy","value":true},{"key":"CategoryActivityPopupWidth","value":"2"},{"key":"CategorySoloMode","value":"0"},{"key":"ChangeEnterBehavior","value":false},{"key":"ChangeMemoEnterBehavior","value":false},{"key":"CheckCreditBalances","value":true},{"key":"CheckNumbers","value":false},{"key":"ClearSelection","value":true},{"key":"CollapseInspector","value":true},{"key":"ColourBlindMode","value":false},{"key":"CompactIncomeVsExpense","value":true},{"key":"ConfirmEditTransactionCancellation","value":false},{"key":"ConfirmKeyboardCancelationOfTransactionChanges","value":true},{"key":"CreditCardEmoji","value":true},{"key":"CtrlEnterCleared","value":false},{"key":"CurrentMonthIndicator","value":true},{"key":"CustomAverageBudgeting","value":"3"},{"key":"CustomFlagNames","value":false},{"key":"CustomizeColourScheme","value":false},{"key":"DateOfMoney","value":true},{"key":"DaysOfBuffering","value":"6"},{"key":"DaysOfBufferingDate","value":true},{"key":"DaysOfBufferingExcludeCreditCards","value":false},{"key":"DaysOfBufferingHistoryLookup","value":"0"},{"key":"DefaultCCToCleared","value":true},{"key":"DeselectTransactionsOnSave","value":false},{"key":"DisableToolkit","value":false},{"key":"DisplayMonthlyGoalsOverview","value":false},{"key":"DisplayTargetGoalAmount","value":false},{"key":"DisplayTotalMonthlyGoals","value":"show-goal-breakdown-and-income-vs-spending"},{"key":"DisplayTotalOverspent","value":false},{"key":"DisplayUpcomingAmount","value":true},{"key":"EasyTransactionApproval","value":false},{"key":"EditAccountButton","value":false},{"key":"EnlargeCategoriesDropdown","value":true},{"key":"FilterCategories","value":true},{"key":"GoalIndicator","value":true},{"key":"GoalWarningColor","value":true},{"key":"GoogleFontsSelector","value":false},{"key":"HideAccountBalancesType","value":false},{"key":"HideAgeOfMoney","value":false},{"key":"HideClosedAccounts","value":false},{"key":"HideDebtRatio","value":false},{"key":"HideHelp","value":true},{"key":"HideReferralBanner","value":true},{"key":"HideTotalAvailable","value":false},{"key":"HighlightNegatives","value":true},{"key":"HoveredBudgetRows","value":true},{"key":"ImportNotification","value":false},{"key":"IncomeFromLastMonth","value":"1"},{"key":"IncomeVsExpenseHoverHighlight","value":true},{"key":"LargerClickableIcons","value":true},{"key":"LastReconciledDate","value":false},{"key":"LinkToInflows","value":true},{"key":"LiveOnLastMonthsIncome","value":false},{"key":"MasterCategoryRowColor","value":true},{"key":"MasterCategoryRowColorSelect","value":"#d1d1d6"},{"key":"MasterCategoryRowDarkColorSelect","value":"#636366"},{"key":"MemoAsMarkdown","value":false},{"key":"MonthlyNotesPopupWidth","value":"2"},{"key":"NavDisplayDensity","value":false},{"key":"NotesAsMarkdown","value":true},{"key":"POSStyleCurrencyEntryMode","value":false},{"key":"Pacing","value":false},{"key":"PrintingImprovements","value":true},{"key":"PrivacyMode","value":false},{"key":"QuickBudgetWarning","value":true},{"key":"ReconcileAssistant","value":true},{"key":"ReconcileBalance","value":true},{"key":"ReconcileConfetti","value":false},{"key":"ReconciledTextColor","value":"3"},{"key":"RemovePositiveHighlight","value":true},{"key":"RemoveZeroCategories","value":true},{"key":"RightClickToEdit","value":true},{"key":"RowHeight","value":"1"},{"key":"RowsHeight","value":"2"},{"key":"SavingsRatio","value":"0.20"},{"key":"ScrollableEditMenu","value":true},{"key":"SeamlessBudgetHeader","value":true},{"key":"SetMultipleFlags","value":false},{"key":"ShowAvailableAfterSavings","value":true},{"key":"ShowCategoryBalance","value":true},{"key":"SpareChange","value":false},{"key":"SplitTransactionAutoAdjust","value":false},{"key":"SplitTransactionAutoFillPayee","value":false},{"key":"SplitTransactionTabExpand","value":true},{"key":"SquareNegativeMode","value":false},{"key":"StealingFromFuture","value":true},{"key":"StripedBudgetRows","value":false},{"key":"SubtractUpcomingFromAvailable","value":"1"},{"key":"SwapClearedFlagged","value":false},{"key":"TargetBalanceWarning","value":true},{"key":"ToBeBudgetedWarning","value":false},{"key":"ToggleAccountColumns","value":true},{"key":"ToggleMasterCategories","value":true},{"key":"ToggleSplits","value":false},{"key":"ToggleTransactionFilters","value":"2"},{"key":"ToolkitReports","value":true},{"key":"UnclearedAccountHighlight","value":true},{"key":"ViewZeroAsEmpty","value":true},{"key":"l10n","value":"0"},{"key":"options.dark-mode","value":false}]
@michaelcmelton
Copy link
Contributor

Thanks for the extensive bug report. I'll take a look at this.

@michaelcmelton michaelcmelton self-assigned this Jun 30, 2022
@michaelcmelton michaelcmelton added the bug Something isn't working label Jun 30, 2022
@joshmadewell joshmadewell removed the bug Something isn't working label Jul 1, 2022
@joshmadewell
Copy link
Member

Yeah there's some weirdness here for sure. I made some changes and very clearly did not test them well...

This should be fixed in our next release (hopefully tomorrow).

@joshmadewell joshmadewell added the pr created A PR has been opened that solves this issue label Jul 1, 2022
@joshmadewell
Copy link
Member

Hey @rhyser9 the fix for this should be in our current release! If you notice the issue still exists and you're definitely running the newest version of the toolkit, please reopen! Thanks!

Please note, all browser can take up to an hour to provide updates to all users. You can force an update if it's available for you by going to chrome://extensions and clicking the "Update" button. Firefox users can go to about:addons, click the setting cog, and click "Check for updates...".

@rhyser9
Copy link
Author

rhyser9 commented Jul 4, 2022

@joshmadewell Starting to re-test on 3.3.2. I can't mark this issue as open, but I can make a new one if desired.

1. "Average Spent (X Mo.)" button should always appear under the default "Average Spent" button, regardless of the actual order of buttons in the Auto-Assign panel.

This is fixed.

2. The 6mo and 12mo average should not show $0.00 and should do something when clicked.

The 6mo average shows a value, and correctly budgets that value when clicked. The 12mo button still always shows $0.00, and budgets $0.00 when clicked.

3. The average spent should display a positive value consistent with the default "Average Spent" option.

This is fixed.

4. The average spent should show the true average spent for the previous 3 months (whether that be last 2 plus current, or previous 3 excluding current).

On a category, the last 3 months spending is April $72, May $0, June $30. With 3 month average enabled, I would expect an average value of $34. Instead, it's showing as $51. I think it's ignoring May since there are no transactions on record. Not sure if this is intended behavior or not.

monthsIncluded.add(transaction.date.format('YYYYMMM'));

Checking a few other categories with 3 or 6 month average enabled, and the average still doesn't seem quite right. Categories 4 and maybe 3 I could chalk up to a rounding issue, but categories 1 and 5 are way off. I can't seem to figure out how it's arriving at the given average, so I don't think it's as simple as missing or including a month it shouldn't. Perhaps starting with a blank budget with sample transactions would give more insight.

Month January February March April May June July Given 3mo Avg Expected 3mo Avg (Apr-Jun) Given 6mo Avg Expected 6mo Avg (Jan-Jun)
Cat. 1 $82.84 $82.80 $76.11 $75.60 $58.29 $104.16 $64.71 $112.72 $79.35 $104.81 $79.97
Cat. 2 $41.17 $226.60 $277.91 $355.88 $485.41 $256.96 $133.24 $359.91 $366.08 $282.08 $273.99
Cat. 3 $43.68 $83.37 $24.04 $74.12 $176.17 $20.01 $8.25 $88.92 $90.10 $69.64 $70.23
Cat. 4 $0.00 $0.00 $0.00 $47.99 $47.99 $47.99 $0.00 $47.97 $47.99 $47.97 $23.99
Cat. 5 $0.00 $155.99 $0.00 $17.75 $30.00 $30.00 $0.00 $51.83 $25.92 $51.38 (not a typo) $38.96

5. Clicking the average spent button should assign a positive value to the category, and should not crash YNAB / assign negative 25 million / 250 billion when clicked.

This is fixed, and all 3 average buttons correctly budget their listed value (albeit, as mentioned above, 12mo is always $0.00).

6. Deleting a transaction should cause the average spent to decrease, especially without having to reload the page.

This is not fixed. Creating a $1000 uncleared transaction on 04/01/2022 in an otherwise empty category sets the 3mo average to $1000. Moving this transaction to 03/31/2022 correctly sets the 3mo average to $0.00. Moving the transaction back to 04/01/2022 and deleting it leaves the 3mo average as $1000.

Creating a second uncleared transaction of $300 sets the 3mo average to $650. A hard refresh, and/or signing out of YNAB, clearing cache/cookies, and signing back in, does not seem to resolve this. Does YNAB still keep track of transactions after they're deleted?

@joshmadewell
Copy link
Member

joshmadewell commented Jul 4, 2022

Ah crap, I think I know what's wrong with your averages...yes, YNAB keeps deleted transactions around and we're not ignoring those haha. I'll get another update to this feature in our next release which should handle this for ya! Thanks again for the detailed report!

That's also why I couldn't reproduce the issue :(

Still not sure what's going on with your 12 month option though...

@rhyser9
Copy link
Author

rhyser9 commented Jul 13, 2022

@joshmadewell v3.3.3, 3mo/6mo is always $0.

The 12mo average is fine, but it looks like when adding transactions to monthsIncluded it's not taking into account months where there are no transactions. Is this intended? IMO if you have a single $120 transaction in the last 12 months, then the 12mo Average Spent should be $10, not $120. Other than that, looks like 12mo average is calculating correctly.

What about removing the monthsIncluded Set logic and using return Math.abs(sum / parseInt(this.settings.enabled as string)); instead?

@joshmadewell
Copy link
Member

@joshmadewell v3.3.3, 3mo/6mo is always $0.

The 12mo average is fine, but it looks like when adding transactions to monthsIncluded it's not taking into account months where there are no transactions. Is this intended? IMO if you have a single $120 transaction in the last 12 months, then the 12mo Average Spent should be $10, not $120. Other than that, looks like 12mo average is calculating correctly.

What about removing the monthsIncluded Set logic and using return Math.abs(sum / parseInt(this.settings.enabled as string)); instead?

Yeah, this was a weird decision to make and this is what I went with because it felt more right.

It feels in the case where you're spending once every four months, you're likely not to use this feature at all but I want the feature to work for users who just turned it on and have only been budgeting for a subset of their chosen window. If you chose a window of six with only 3 months of data, you'd have a "wrong" average.

@rhyser9
Copy link
Author

rhyser9 commented Jul 17, 2022

v3.3.4 button is missing, verified option was enabled in settings.
image

@williammck
Copy link
Member

I think everything here should be fixed as of v3.4.0? Feel free to let us know if you notice anything else awry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants