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

Don't allow duplicate category names (per group) #1833

Merged
merged 24 commits into from
Nov 20, 2023

Conversation

Shazib
Copy link
Contributor

@Shazib Shazib commented Oct 28, 2023

GUI Level check and a separate one at DB to catch API etc.

@netlify
Copy link

netlify bot commented Oct 28, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit a40e607
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/655a34143e173c00080ab308
😎 Deploy Preview https://deploy-preview-1833.demo.actualbudget.org/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2023

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
16 2.97 MB → 2.97 MB (+566 B) +0.02%
Changeset
File Δ Size
src/components/budget/index.tsx 📈 +1.03 kB (+6.41%) 16.08 kB → 17.11 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/wide-components.chunk.js 117.06 kB → 117.61 kB (+566 B) +0.47%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/main.js 1.16 MB 0%
static/js/665.chunk.js 824.28 kB 0%
static/media/Inter-italic.var.woff2 239.29 kB 0%
static/media/Inter-roman.var.woff2 221.86 kB 0%
static/js/444.chunk.js 156.11 kB 0%
static/js/231.chunk.js 117.37 kB 0%
static/js/reports.chunk.js 74.37 kB 0%
static/js/narrow-components.chunk.js 52.67 kB 0%
static/js/301.chunk.js 13.31 kB 0%
static/js/473.chunk.js 13 kB 0%
static/js/resize-observer-polyfill.chunk.js 8.88 kB 0%
static/css/main.css 7.41 kB 0%
asset-manifest.json 2.07 kB 0%
index.html 1.66 kB 0%
static/media/browser-server.js 903 B 0%

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2023

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
2 2.22 MB → 2.22 MB (+226 B) +0.01%
Changeset
File Δ Size
packages/loot-core/src/server/db/index.ts 📈 +419 B (+2.41%) 17 kB → 17.41 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.23 MB → 1.23 MB (+226 B) +0.02%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
xfo.xfo.kcab.worker.js 1014.46 kB 0%

@rich-howell
Copy link
Contributor

Hey @Shazib

This doesn't actually fix the problem though, I could create Food in one group then hide it and create it later in another group and it would still show me two Food's on the transaction entry.

I would have to go back to the budget check which group the category is showing for then go back to the transaction entry screen and enter the transaction..seems like a lot of clicking around.

What would the use case be for two categories on the budget being called the same thing ever existing? For example, would this be a possibility?

Usual Expenses - Food
Bills - Food

If it wouldn't it might be worth preventing duplicate category names entirely?

@Shazib
Copy link
Contributor Author

Shazib commented Oct 28, 2023

If it wouldn't it might be worth preventing duplicate category names entirely?

Hi @rich-howell,

I can envisage scenarios where you have multiple of the same categories under different groups

e.g.
"Work Expenses" -> "Food"
"Travel" -> "Food"
"Household" -> "Food"

Or
"Holidays" -> "Travel Costs"
"Work" -> "Travel Costs"

Maybe the popup could show you the group as well?

@Shazib
Copy link
Contributor Author

Shazib commented Oct 28, 2023

Maybe the popup could show you the group as well?

Maybe the popup could indicate hidden categories?

@Shazib
Copy link
Contributor Author

Shazib commented Oct 28, 2023

@rich-howell what do you think

image

@Crazypkr1099
Copy link
Contributor

@rich-howell what do you think

image

I don't like this. It's going to clutter the crap out of it. Honestly I don't see the big deal with checking your hiddens before creating a group 🤷

@Shazib
Copy link
Contributor Author

Shazib commented Oct 28, 2023

I don't like this. It's going to clutter the crap out of it. Honestly I don't see the big deal with checking your hiddens before creating a group 🤷

Do people have loads of hidden categories? I wouldnt consider that super cluttered personally!

@Shazib
Copy link
Contributor Author

Shazib commented Oct 28, 2023

I actually think its kind of useful to see if its hidden 🤷

Although maybe this is kind of two separate PR's; not allowing duplicate names is fairly straightforward.

@youngcw
Copy link
Member

youngcw commented Oct 28, 2023

I think the category picker change should be a separate PR.

Have you checked the case of moving a category from one group to another? I would be ok with allowing same names but different groups, but then we need to do the checks on moves as well as creates. That wouldn't matter if only one of the same name are allowed.

@Shazib
Copy link
Contributor Author

Shazib commented Oct 28, 2023

I think the category picker change should be a separate PR.

Have you checked the case of moving a category from one group to another? I would be ok with allowing same names but different groups, but then we need to do the checks on moves as well as creates. That wouldn't matter if only one of the same name are allowed.

The change isn't actually in the PR just a screenshot.

I will check the case of moving a category!

@Shazib Shazib changed the title Don't allow duplicate category names (per group) [WIP] Don't allow duplicate category names (per group) Oct 28, 2023
@Shazib Shazib changed the title [WIP] Don't allow duplicate category names (per group) Don't allow duplicate category names (per group) Oct 29, 2023
@rich-howell
Copy link
Contributor

@rich-howell what do you think
image

I don't like this. It's going to clutter the crap out of it. Honestly I don't see the big deal with checking your hiddens before creating a group 🤷

There are two workflows here that are impacted by hidden categories and the ability to create a category with a duplicate name.

The Budget Sheet

If you have a category you created 2 years ago and it is hidden your not going to remember that you hid it before creating a new one, I don't think the workflow of checking if the category is hidden before creating any new category really works all that well.

Transaction Sheet

When adding a new transaction, the category shows regardless of if it is hidden or not so if you select the category you hid two years ago and remember you might not know it is there you will be thinking why is my budget now showing negative numbers.

My thoughts

I agree that seeing if the category is hidden in the category picker is an improvement on the current workflow and would solve the problem entirely. (You might not even have to stop people creating duplicates)

@youngcw
Copy link
Member

youngcw commented Nov 7, 2023

This seems to be working well. Can you look at getting the tests to pass, and the merge conflicts cleared up?

@carkom
Copy link
Contributor

carkom commented Nov 8, 2023

This is great @Shazib. Maybe you'd be interested in doing the same for account names? If not, no worries. Cheers!

@Shazib
Copy link
Contributor Author

Shazib commented Nov 10, 2023

For point 1, Can't you just hit escape?

That doesn't close the category creation view, just clears the filled in name.

Yes sorry - you can just click off it though, you don't have to go through with the create, it cancels if you focus away from the cell

@Shazib
Copy link
Contributor Author

Shazib commented Nov 10, 2023

This still doesn't fix the problem in that I raised in the issue, it is still not clear in the category drop down which category is hidden and which isn't (screenshot taken from the deploy preview)

image

I have removed the tag linking that issue.

I think this is safe to merge standalone while we work on that.

@youngcw
Copy link
Member

youngcw commented Nov 16, 2023

@Shazib This is pretty much ready right? If you merge master the electron issues should be fixed.

@Shazib
Copy link
Contributor Author

Shazib commented Nov 16, 2023

@Shazib This is pretty much ready right? If you merge master the electron issues should be fixed.

@youngcw yep. I'll merge master tonight.

@youngcw
Copy link
Member

youngcw commented Nov 16, 2023

Should this check for same name, different case? ie not capitalized

@Shazib
Copy link
Contributor Author

Shazib commented Nov 17, 2023

Should this check for same name, different case? ie not capitalized

good spot - added

@carkom
Copy link
Contributor

carkom commented Nov 17, 2023

This is great @Shazib. Maybe you'd be interested in doing the same for account names? If not, no worries. Cheers!

Might be good to also do group names? Could be a separate PR.

@Shazib
Copy link
Contributor Author

Shazib commented Nov 17, 2023

This is great @Shazib. Maybe you'd be interested in doing the same for account names? If not, no worries. Cheers!

Might be good to also do group names? Could be a separate PR.

Yeh i'd do that as a separate PR to avoid scope creep with this one.

@youngcw youngcw merged commit 9c6d9ec into actualbudget:master Nov 20, 2023
19 checks passed
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved labels Nov 20, 2023
FlorianLang06 pushed a commit to FlorianLang06/actual that referenced this pull request Mar 7, 2024
* Remove author from electron package.json

* Don't allow dupes in cat names (per group)

* Release Notes

* Handle reorders and moves

* Fix linter warnings

* Fix typecheck

* Show the name of the duplicate category

* missed func call

* Upper case before compare

* lint fixes

---------

Co-authored-by: Shazib Hussain <[email protected]>
@Shazib Shazib deleted the category-guard branch May 24, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants