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

[HOLD for payment 2024-08-19] [$250] Report fields - List values are not arranged in alphabetical order #46528

Closed
6 tasks done
lanitochka17 opened this issue Jul 30, 2024 · 28 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

@lanitochka17
Copy link

lanitochka17 commented Jul 30, 2024

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: 9.0.14-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: n/a
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Report fields
  3. Click Add field
  4. Select List from Type
  5. Go to List values and add a few list values

Expected Result:

The list values will be arranged in alphabetical order

Actual Result:

The list values are arranged in the order of time added

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6557073_1722326131653.20240730_155335.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a0087963c0b045ee
  • Upwork Job ID: 1819053827579434361
  • Last Price Increase: 2024-08-01
  • Automatic offers:
    • paultsimura | Reviewer | 103375714
    • cretadn22 | Contributor | 103375715
Issue OwnerCurrent Issue Owner: @isabelastisser
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 30, 2024
Copy link

melvin-bot bot commented Jul 30, 2024

Triggered auto assignment to @isabelastisser (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.

@lanitochka17
Copy link
Author

@isabelastisser FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-control

@cretadn22
Copy link
Contributor

cretadn22 commented Jul 30, 2024

Proposal

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

List values are not arranged in alphabetical order

What is the root cause of that problem?

const data = listValues.map<ValueListItem>((value, index) => ({

We don't add sort function for listValues

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

Add sort function in alphabetical order

sort((a, b) => localeCompare(a, b)

The same problem also happen in report field page

Ảnh chụp Màn hình 2024-07-31 lúc 01 27 15

We also need to add sort function

data: Object.values(filteredPolicyFieldList).map((reportField) => ({

const listValueSections = useMemo(
() => [
{
data: Object.values(listValues ?? {})
.filter((listValue, index) => !disabledOptions[index])
.map((listValue) => ({
keyForList: listValue,
value: listValue,
isSelected: value === listValue,
text: listValue,
})),
},
],
[value, listValues, disabledOptions],
);

And other places (we need to find out while implementing PR)

What alternative solutions did you explore? (Optional)

@FitseTLT
Copy link
Contributor

FitseTLT commented Jul 30, 2024

Proposal

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

Report fields - List values are not arranged in alphabetical order

What is the root cause of that problem?

We haven't sorted the list based on the name here

const data = listValues.map<ValueListItem>((value, index) => ({
value,
index,
text: value,
keyForList: value,
isSelected: selectedValues[value],
enabled: !disabledListValues[index] ?? true,
pendingAction: reportFieldID ? policy?.fieldList?.[ReportUtils.getReportFieldKey(reportFieldID)]?.pendingAction : null,
rightElement: (
<ListItemRightCaretWithLabel
shouldShowCaret={false}
labelText={disabledListValues[index] ? translate('workspace.common.disabled') : translate('workspace.common.enabled')}
/>
),
}));

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

We need to sort it as

const data = listValues
            .sort((a, b) => localeCompare(a.toLocaleLowerCase, b.toLocaleLowerCase()))
            .map<ValueListItem>((value, index) => ({
                value,
                index,
                text: value,
                keyForList: value,
                isSelected: selectedValues[value],
                enabled: !disabledListValues[index] ?? true,
                pendingAction: reportFieldID ? policy?.fieldList?.[ReportUtils.getReportFieldKey(reportFieldID)]?.pendingAction : null,
                rightElement: (
                    <ListItemRightCaretWithLabel
                        shouldShowCaret={false}
                        labelText={disabledListValues[index] ? translate('workspace.common.disabled') : translate('workspace.common.enabled')}
                    />
                ),
            }));

We need to apply sorting on other places we use list field like here

const listValueSections = useMemo(
() => [
{
data: Object.values(listValues ?? {})
.filter((listValue, index) => !disabledOptions[index])
.map((listValue) => ({
keyForList: listValue,
value: listValue,
isSelected: value === listValue,
text: listValue,
})),
},
],
[value, listValues, disabledOptions],
);

In EditDropdownFieldpage

What alternative solutions did you explore? (Optional)

@FitseTLT
Copy link
Contributor

Updated to add other places we need to apply the sorting

@cretadn22
Copy link
Contributor

Update proposal to cover other similar bug

@isabelastisser isabelastisser added External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Aug 1, 2024
@melvin-bot melvin-bot bot changed the title Report fields - List values are not arranged in alphabetical order [$250] Report fields - List values are not arranged in alphabetical order Aug 1, 2024
Copy link

melvin-bot bot commented Aug 1, 2024

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

Copy link

melvin-bot bot commented Aug 1, 2024

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

@paultsimura
Copy link
Contributor

Reviewing soon 👀

@paultsimura
Copy link
Contributor

paultsimura commented Aug 2, 2024

Hmm, the situation here is a bit ambiguous.

@cretadn22 was the first to post the proposal, while @FitseTLT was the first to notice that we need to add similar sorting in other places.

Both proposals look very similar (and quite simple) to me, therefore I would go with @cretadn22's proposal as it was the first one. But I also would appreciate a second opinion from the assigned engineer.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 2, 2024

Triggered auto assignment to @flodnv, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@flodnv
Copy link
Contributor

flodnv commented Aug 2, 2024

I'm ooo as of now and for 10 days, @paultsimura please reassign by commenting 🎀👀🎀 C+ reviewed

@paultsimura
Copy link
Contributor

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 2, 2024

Triggered auto assignment to @youssef-lr, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@paultsimura
Copy link
Contributor

Hey @youssef-lr, could you please take a second for a final decision based on this?

@youssef-lr
Copy link
Contributor

Agree with your decision @paultsimura

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

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

Offer link
Upwork job

Copy link

melvin-bot bot commented Aug 2, 2024

📣 @cretadn22 🎉 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 3, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@paultsimura
Copy link
Contributor

⬆️ False alarm from my mention.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 12, 2024
@melvin-bot melvin-bot bot changed the title [$250] Report fields - List values are not arranged in alphabetical order [HOLD for payment 2024-08-19] [$250] Report fields - List values are not arranged in alphabetical order Aug 12, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 12, 2024
Copy link

melvin-bot bot commented Aug 12, 2024

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

Copy link

melvin-bot bot commented Aug 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.18-10 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 2024-08-19. 🎊

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

Copy link

melvin-bot bot commented Aug 12, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@paultsimura] The PR that introduced the bug has been identified. Link to the PR:
  • [@paultsimura] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@paultsimura] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@paultsimura] Determine if we should create a regression test for this bug.
  • [@paultsimura] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@paultsimura
Copy link
Contributor

This was a feature request, therefore no offending PR.

Regression Test Proposal

  1. Go to a workspace settings > Report fields (enable them in "More features" if needed)
  2. Click "Add field"
  3. Select "List" from "Type"
  4. Go to "List values" and add a few values
  5. Verify the list values are arranged in alphabetical order
  6. Open the "Initial value" menu
  7. Verify the list values are arranged in alphabetical order
  8. Save the field
  9. Add one more report field
  10. Verify the report fields are arranged in alphabetical order
  11. Create an Expense report with this workspace
  12. Navigate to this report
  13. Click on one of the report fields on top of the report (to select the value)
  14. Verify the list values are arranged in alphabetical order

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Aug 18, 2024
@isabelastisser
Copy link
Contributor

@youssef-lr, do you agree with the Regression Test Proposal?

@melvin-bot melvin-bot bot removed the Overdue label Aug 19, 2024
@isabelastisser
Copy link
Contributor

Payment summary:

@paultsimura, $250 for C+ review. Paid in Upwork.
@cretadn22, $250 for proposal. Paid in Upwork.

@isabelastisser
Copy link
Contributor

All set!

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

7 participants