-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[$500] Default category set for distance expense in a policy does not auto populate when creating expense #34448
Comments
Triggered auto assignment to @isabelastisser ( |
Job added to Upwork: https://www.upwork.com/jobs/~0164f6cd9ebd57caa6 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @c3024 ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Default category set for distance expense in a policy does not auto populate when creating expense What is the root cause of that problem?We are only displaying category if it exists in the transaction here App/src/components/MoneyTemporaryForRefactorRequestConfirmationList.js Lines 786 to 787 in 55746c7
What changes do you think we should make in order to solve the problem?We should display the default category checking the workspace participant has default category set and distance request.
NOTE that there is also BE job required because now we are not receiving the What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.When a default Distance category is set for the workspace, it should be visible on the Confirmation step as well. What is the root cause of that problem?We have not yet implemented the What changes do you think we should make in order to solve the problem?First, we should fetch the distance-specific default category. It is located under the We can add it as an util function to the function getDefaultCategory(policy: OnyxEntry<Policy>): string | null {
if (!policy?.customUnits) {
return null;
}
const distanceUnit = Object.values(policy.customUnits).find((unit) => unit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE);
return distanceUnit?.defaultCategory;
} Then, we should handle this default category similar to how we handle the tax rates: if it's not present on the transaction, use the default one on the Confirmation Step (I'll attach references to similar code blocks of TaxRates logic): const shouldShowCategories = isPolicyExpenseChat && (iouCategory || OptionsListUtils.hasEnabledOptions(_.values(policyCategories)));
const categoryTitle = iouCategory || isDistanceRequest && DistanceRequestUtils.getDefaultCategory(policy); App/src/components/MoneyTemporaryForRefactorRequestConfirmationList.js Lines 295 to 297 in 076f03e
And on the const isDistanceRequest = TransactionUtils.isDistanceRequest(transaction);
const defaultCategory = isDistanceRequest ? DistanceRequestUtils.getDefaultCategory(policy) : '';
const selectedCategory = transaction.category || defaultCategory; App/src/pages/iou/request/step/IOURequestStepTaxRatePage.js Lines 57 to 59 in 72693dc
What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Default category isn't set for the distance transaction whereas it is set in the policy What is the root cause of that problem?Currenty, we are not fetching and setting the default category from the policy for the transaction in
What changes do you think we should make in order to solve the problem?Consider fetching the const distanceCustomUnit = _.find(lodashGet(policy, 'customUnits', {}), (unit) => unit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE);
if(!transaction.category && distanceCustomUnit) {
IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, distanceCustomUnit.defaultCategory);
} ResultScreen.Recording.2024-01-12.at.22.05.17.mp4 |
ProposalPlease re-state the problem that we are trying to solve in this issue.Not auto populated. Only after creating the expense category is set What is the root cause of that problem?We are not getting the default policy from the custom unit of the workspace to display if category doesn't exist from What changes do you think we should make in order to solve the problem?
*Note: We need to store it into OPTIONAL: After we select a workspace or create a request from a policy expense chat we can update default category into What alternative solutions did you explore? (Optional) |
Hey @c3024, can you please review the proposals above? Thanks! |
@isabelastisser, @c3024 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Will update today |
Hey @c3024, did you have the chance to review the proposals? Thanks! |
Thank you for all your proposals. I think setting the category in the transaction is the best solution. It updates the category picker page as well correctly. @Pujan92 's proposal here looks good to me. 🎀 👀 🎀 C+ Reviewed |
Triggered auto assignment to @mountiny, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Just found that this will be fixed here #34012 |
Thanks for the heads up, @dukenv0307 ! Closing this issue then. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.24-6
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @puneetlath
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1705010484215319
Action Performed:
Expected Result:
Default currency should be auto populated
Actual Result:
Not auto populated. Only after creating the expense category is set
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Recording.2658.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: