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

Add 'Duplicate Transaction' to bulk editor for #548 #582

Merged

Conversation

gsumpster
Copy link
Contributor

Completes #548!

This function will duplicate root level transactions that are selected, it will also duplicate children (even from different parents). This function will be disabled if a user attempts to select both parent transactions and children transactions as that's a little ambiguous as to what they want us to do there.

Thanks to @MatissJanis for helping me with some of the edge cases on how this functionality should work!

@netlify
Copy link

netlify bot commented Jan 27, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 87d98cf
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/63d5790f48dc4900088891f8
😎 Deploy Preview https://deploy-preview-582--actualbudget.netlify.app/
📱 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 settings.

@@ -480,6 +483,14 @@ function SelectedTransactionsButton({
};
}, [selectedItems]);

let ambiguousDuplication = useMemo(() => {
let transactions = [...selectedItems].map(id => getTransaction(id));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone has any suggestions for how this ambitiousDuplication fn can be improved, would love to hear them, seems a little unfortunate that we have to get ALL the selected transactions to determine if we can enable this functionality or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could show an error message after hitting the duplicate button (since the case where the duplication is invalid is unlikely, right?)

It might also make sense to duplicate just the top level transaction if it is selected along with some of its children (since that most closely marches the expected behavior IMO).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an error message makes more sense here, agreed.

I can see either way with this behavior to be honest. I think overall duplicating child transactions seems like a bit of an unnecessary feature in my opinion, especially with updating the parents amount automatically, it just seems a bit backwards to how I personally go about splitting a transaction.

Would be super interested to hear if anyone does have a workflow where duplicating individual child transactions would be useful!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be super interested to hear if anyone does have a workflow where duplicating individual child transactions would be useful!

Maybe start by not duplicating child transactions and wait for someone to complain?

Copy link
Contributor Author

@gsumpster gsumpster Jan 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that sounds like a better plan! I'll go ahead remove the child duplication code, easy to add back in later if it is a desired feature

@MatissJanis, wanted to ping you here since we spoke about this earlier on Discord!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

@rich-howell
Copy link
Contributor

Adding myself into the loop here as this will need docs.

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good!

@@ -480,6 +482,14 @@ function SelectedTransactionsButton({
};
}, [selectedItems]);

let ambiguousDuplication = useMemo(() => {
let transactions = [...selectedItems].map(id => getTransaction(id));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥜 nitpick:

Suggested change
let transactions = [...selectedItems].map(id => getTransaction(id));
let transactions = selectedItems.map(id => getTransaction(id));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MatissJanis, had to add this back, selectedItems is a Set and can't use .map

packages/desktop-client/src/components/accounts/Account.js Outdated Show resolved Hide resolved
packages/desktop-client/src/components/accounts/Account.js Outdated Show resolved Hide resolved
@trafico-bot trafico-bot bot added ⚠️ Changes requested Pull Request needs changes before it can be reviewed again and removed 🔍 Ready for Review labels Jan 28, 2023
gsumpster and others added 2 commits January 28, 2023 11:23
Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
@trafico-bot trafico-bot bot added 🔍 Ready for Review and removed ⚠️ Changes requested Pull Request needs changes before it can be reviewed again labels Jan 28, 2023
Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Thanks for all your hard work!

@MatissJanis MatissJanis merged commit dd5e915 into actualbudget:master Jan 28, 2023
@trafico-bot trafico-bot bot added ✅ Approved ✨ Merged Pull Request has been merged successfully and removed 🔍 Ready for Review ✨ Merged Pull Request has been merged successfully labels Jan 28, 2023
FlorianLang06 pushed a commit to FlorianLang06/actual that referenced this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants