Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Improve creating expenses on Collect with Instant Submit #36388
Improve creating expenses on Collect with Instant Submit #36388
Changes from 7 commits
9bc5b38
34917e5
99d1542
4fc82e7
f165755
771eef6
4eb5cbf
9587d19
a2675fe
72ddbc8
f5a5959
5be0b3f
206cd78
f0a99eb
933e0d8
902f45c
9cccb7e
267de9d
4e9ccc9
c0371b2
9eb9b97
8496f5d
ee17782
6a464b3
1777c68
9d9caf6
3fcd191
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this comment, or update it to match the new condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the code is self-explanatory, so we can remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @youssef-lr is there any doc that helps me verify this logic? Or can you help to leave a comment in code to explain it? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add a comment. There is a doc, but I think you might not have access to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment already explains this logic. If Instant Submit is turned on, we can add expenses to an already submitted report. If reporting frequency is set to 'Weekly', then we can only add expenses to draft reports (i.e. not submitted yet).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying @youssef-lr .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe at this point you can revert this change after pulling
main
- since this was just added in #36997 - sorry!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Beamanator I'm thinking of removing that helper function, it seems unnecessary and the naming is verbose and a bit confusing. imo
PolicyUtils.isInstantSubmitEnabled(policy) && isProcessingReport(report)
is more readable thanisExpenseReportWithInstantSubmittedState
, what is reallyInstantSubmittedState
? I get that it means the report is submitted and under Instant Submit but it can be confusing for someone unfamiliar with this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean & yeah maybe the function name is kinda gross, but don't we reuse the same check (
PolicyUtils.isInstantSubmitEnabled(policy) && isProcessingReport(report)
) in many places & won't we continue to do so? So wouldn't it be nice to make a util function for this? I slightly prefer a util function IFF we can come up with a good name for it that's super clear 😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I can't think of a way to improve that function name, so I think I'll create a new one which will instead decide if we can add transactions to a report or not, similar to how we do it in Auth. Will commit the update and let me know what you think! I think it looks cleaner and is more generic and reusable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanna double check whether we should use
ReportUtils.isPaidGroupPolicyExpenseReport
instead ofReportUtils.isPaidGroupPolicy
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't really matter, both should work fine.