Skip to content

[Due for payment 2025-03-10] [$125] Refactor getTrackExpenseInformation to use a parameter object #57190

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

Closed
neil-marcellini opened this issue Feb 20, 2025 · 20 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@neil-marcellini
Copy link
Contributor

neil-marcellini commented Feb 20, 2025

As part of the tracking issue, and as advised in its description, refactor getTrackExpenseInformation to use a parameter object.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021892615722799321204
  • Upwork Job ID: 1892615722799321204
  • Last Price Increase: 2025-02-21
  • Automatic offers:
    • mkzie2 | Contributor | 106227000
Issue OwnerCurrent Issue Owner: @VictoriaExpensify
@neil-marcellini neil-marcellini added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor labels Feb 20, 2025
@neil-marcellini neil-marcellini self-assigned this Feb 20, 2025
Copy link

melvin-bot bot commented Feb 20, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021892615722799321204

@melvin-bot melvin-bot bot changed the title Refactor getTrackExpenseInformation to use a parameter object [$250] Refactor getTrackExpenseInformation to use a parameter object Feb 20, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 20, 2025
Copy link

melvin-bot bot commented Feb 20, 2025

Triggered auto assignment to @VictoriaExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Copy link

melvin-bot bot commented Feb 20, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (External)

@mkzie2
Copy link
Contributor

mkzie2 commented Feb 20, 2025

Proposal

Please re-state the problem that we are trying to solve in this issue.

Refactor convertTrackedExpenseToRequest function to use a parameter object

What is the root cause of that problem?

This is an improvement

What changes do you think we should make in order to solve the problem?

Wrap all parameters of this function into one object and in this object, we can have some sub-objects that will wrap the related data.

function getTrackExpenseInformation(

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

None

What alternative solutions did you explore? (Optional)

@mkzie2
Copy link
Contributor

mkzie2 commented Feb 20, 2025

@neil-marcellini Please assign me.

@KALU-c
Copy link

KALU-c commented Feb 20, 2025

Proposal

Please re-state the problem that we are trying to solve in this issue.

The getTrackExpenseInformation function has too many parameters, making it hard to read, maintain, and update.

What is the root cause of that problem?

The function takes too many separate arguments instead of a single object, making it harder to read and manage.

What changes do you think we should make in order to solve the problem?

Change getTrackExpenseInformation to take one object instead of a long list of arguments.

App/src/libs/actions/IOU.ts

Lines 3079 to 3101 in 32cfa66

function getTrackExpenseInformation(
parentChatReport: OnyxEntry<OnyxTypes.Report>,
participant: Participant,
comment: string,
amount: number,
currency: string,
created: string,
merchant: string,
receipt: OnyxEntry<Receipt>,
category: string | undefined,
tag: string | undefined,
taxCode: string | undefined,
taxAmount: number | undefined,
billable: boolean | undefined,
policy: OnyxEntry<OnyxTypes.Policy> | undefined,
policyTagList: OnyxEntry<OnyxTypes.PolicyTagLists> | undefined,
policyCategories: OnyxEntry<OnyxTypes.PolicyCategories> | undefined,
payeeEmail = currentUserEmail,
payeeAccountID = userAccountID,
moneyRequestReportID = '',
linkedTrackedExpenseReportAction?: OnyxTypes.ReportAction,
existingTransactionID?: string,
): TrackExpenseInformation | null {

Also, update all function calls to use the new object format.

App/src/libs/actions/IOU.ts

Lines 4821 to 4845 in 32cfa66

getTrackExpenseInformation(
currentChatReport,
participant,
comment,
amount,
currency,
created,
merchant,
trackedReceipt,
category,
tag,
taxCode,
taxAmount,
billable,
policy,
policyTagList,
policyCategories,
payeeEmail,
payeeAccountID,
moneyRequestReportID,
linkedTrackedExpenseReportAction,
isMovingTransactionFromTrackExpense && linkedTrackedExpenseReportAction && isMoneyRequestAction(linkedTrackedExpenseReportAction)
? getOriginalMessage(linkedTrackedExpenseReportAction)?.IOUTransactionID
: undefined,
) ?? {};

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

None

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Copy link

melvin-bot bot commented Feb 20, 2025

📣 @KALU-c! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@KALU-c
Copy link

KALU-c commented Feb 20, 2025

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01154410394d30729e

Copy link

melvin-bot bot commented Feb 20, 2025

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@s77rt
Copy link
Contributor

s77rt commented Feb 20, 2025

@mkzie2 @KALU-c Thank you for the proposals. Given that this is a straightforward change we'd go with the first proposal i.e. @mkzie2 `s

🎀 👀 🎀 C+ reviewed
Link to proposal

Copy link

melvin-bot bot commented Feb 20, 2025

Current assignee @neil-marcellini is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 21, 2025
Copy link

melvin-bot bot commented Feb 21, 2025

📣 @mkzie2 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@neil-marcellini neil-marcellini changed the title [$250] Refactor getTrackExpenseInformation to use a parameter object [$125] Refactor getTrackExpenseInformation to use a parameter object Feb 21, 2025
Copy link

melvin-bot bot commented Feb 21, 2025

Upwork job price has been updated to $125

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 24, 2025
@mkzie2
Copy link
Contributor

mkzie2 commented Feb 24, 2025

@s77rt The PR is ready.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 3, 2025
@melvin-bot melvin-bot bot changed the title [$125] Refactor getTrackExpenseInformation to use a parameter object [Due for payment 2025-03-10] [$125] Refactor getTrackExpenseInformation to use a parameter object Mar 3, 2025
Copy link

melvin-bot bot commented Mar 3, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 3, 2025
Copy link

melvin-bot bot commented Mar 3, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.7-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-03-10. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 3, 2025

@s77rt @VictoriaExpensify @s77rt The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@s77rt
Copy link
Contributor

s77rt commented Mar 8, 2025

No checklist is needed

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 10, 2025
@VictoriaExpensify
Copy link
Contributor

Payment summary:
C: @mkzie2 paid $125 via Upwork
C+: @s77rt owed $125 via NewDot

@JmillsExpensify
Copy link

$125 approved for @s77rt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants