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 2023-08-17] [$1000] Completed task gets re-indexed if edited. #23883

Closed
1 of 6 tasks
kavimuru opened this issue Jul 30, 2023 · 49 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jul 30, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Create a task
  2. Set to completed
  3. Open task report and write something & watch the sidebar

Expected Result:

Completed task should not be reindex and should not move to top to the report list or if it has to move up then it should persist its index.

Actual Result:

Completed tasks moves to top while writing something in composer and gets back to its position if the message is sent.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.47-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

completed_task_reindexing.mp4
Recording.1403.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Krishna2323
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690436338235719

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ffb623af5dcd64cc
  • Upwork Job ID: 1687217514400518144
  • Last Price Increase: 2023-08-03
  • Automatic offers:
    • dukenv0307 | Contributor | 25999076
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 30, 2023

Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 30, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@niteshletxsoft
Copy link

niteshletxsoft commented Jul 30, 2023

Proposal

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

Completed task should not be reindex and should not move to top to the report list or if it has to move up then it should persist its index.

What is the root cause of that problem?

The root cause of this issue is the ordering of the report ID's based on their status and when the completed task has a draft comment, According to the current logic all draft report comes on the top.

if (report.hasDraft) {
draftReports.push(report);
return;
}

 if (report.hasDraft) {
      draftReports.push(report);
      return;
  }

This is the part of the code, which is causing the current issue.

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

The actual solution to this issue is to keep the Completed task at their position even if the task has a draft comment.

We can check if this REPORT is a task and completed one, We will not put the REPORT in the draftReports array.

// The completed tasks should not move the position when have a draft
if (report.hasDraft && !(ReportUtils.isTaskReport(report) && ReportUtils.isCompletedTaskReport(report))) {
    draftReports.push(report);
    return;
}

As per the another half comment of the issue by the reporter "if it has to move up then it should persist its index."
We can not update the completed task position on new comments because this will conflict with the logic of archivedReports, which keeps the completed task at the bottom of the list.

What alternative solutions did you explore? (Optional)

N/A

@dukenv0307
Copy link
Contributor

Not a bug, we prioritize the draft report on LHN

@twisterdotcom
Copy link
Contributor

I agree, this is intentional. Not a bug.

@thienlnam
Copy link
Contributor

I had the same initial view but in the video, it looks like after you send the message it is reverting it’s position which is the bug here. I agree it reindexing while in draft state is correct, but it seems like after the message is sent and it is no longer in draft state it should stay at the top

@twisterdotcom
Copy link
Contributor

Hmmm, yes I haven't not used focus mode for a long time. I'll retest this.

@twisterdotcom twisterdotcom reopened this Jul 31, 2023
@niteshletxsoft
Copy link

Yes, You are right @thienlnam. either the completed task should change the position on draft and keep the position after sending the message or should not change the position when has the draft message.
As shown in the bug, It changes the position when has the draft message and come back to original position when message is sent.

According to me, It should not come to top position with draft message as the task has been completed and that's the solution i have provided.

@dukenv0307
Copy link
Contributor

Proposal

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

Completed tasks move to the top while writing something in Composer and get back to its position if the message is sent.

What is the root cause of that problem?

  • The order report in LHN is calculated based on this line of code:

return _.pluck([].concat(pinnedReports).concat(outstandingIOUReports).concat(draftReports).concat(nonArchivedReports).concat(archivedReports), 'reportID');

  • Then, the proper order in LHN will be
    Pinned Report -> outstandingIOU Reports -> Draft Reports -> Non Archived Reports -> Archived Reports

  • In the current code, when a task is marked as completed, it will be pushed to the Archived Reports ( last position in the array of reports )

if (ReportUtils.isTaskReport(report) && ReportUtils.isCompletedTaskReport(report)) {
archivedReports.push(report);
return;
}

  • When creating a draft comment, it will be marked as Draft Reports ( the 3rd position )
  • After the comment was sent, that report will be marked as Archived Reports again, as a result, it will be re-index and moved to the end of the report array in LHN. That's why we see the re-index issue.

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

I think we should not consider a completed task as a Archived report but Non Archived Report instead. Since as I see in the UI. An archived report always has two characteristics

  1. Having ( archived ) text next to it's name
  2. No new comment are allowed
Screenshot 2023-08-02 at 17 14 18

Therefore, after marking a completed task as non archived report, the after adding a new comment, completed tasks will stay on top in LHN

Result:

Screen.Recording.2023-08-02.at.17.18.48.mov

What alternative solutions did you explore? (Optional)

@dukenv0307
Copy link
Contributor

@thienlnam Completed tasks are initially marked as Archived Report in this PR files https://github.com/Expensify/App/pull/18931/files

@melvin-bot melvin-bot bot added the Overdue label Aug 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

@twisterdotcom Whoops! This issue is 2 days overdue. Let's get this updated quick!

@twisterdotcom
Copy link
Contributor

I think we should not consider a completed task as a Archived report but Non Archived Report instead

This makes sense to me.

@melvin-bot melvin-bot bot removed the Overdue label Aug 3, 2023
@twisterdotcom twisterdotcom added External Added to denote the issue can be worked on by a contributor Overdue labels Aug 3, 2023
@melvin-bot melvin-bot bot changed the title Completed task gets re-indexed if edited. [$1000] Completed task gets re-indexed if edited. Aug 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

Current assignee @twisterdotcom is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

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

@twisterdotcom
Copy link
Contributor

@parasharrajat and @thienlnam - can we assign @dukenv0307 on this one?

@parasharrajat
Copy link
Member

IMO, @dukenv0307 's proposal looks good. But I am not sure of the Task design. Why did we move the task to archived when a user can still message in that thread?

🎀 👀 🎀 C+ reviewed

@dukenv0307
Copy link
Contributor

@parasharrajat The PR is ready for review

@parasharrajat
Copy link
Member

parasharrajat commented Aug 8, 2023

I noticed that all reports change position when drafts are added/removed from them. Are we trying to change that?

Earlier, I got distracted by the mention of the completion of a task in the issue. And I focused on #23883 (comment) & #23883 (comment) as the expected result from triaging. If this is in fact the expected result then we are on track and no action is due. Thus we should update the issue @twisterdotcom to correctly reflect that.

Otherwise, we should fix the issue description and discuss the real problem that reports change position when drafts are added/removed on LHN

@melvin-bot
Copy link

melvin-bot bot commented Aug 9, 2023

🎯 ⚡️ Woah @parasharrajat / @dukenv0307, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @dukenv0307 got assigned: 2023-08-08 00:26:00 Z
  • when the PR got merged: 2023-08-09 04:56:40 UTC

On to the next one 🚀

@twisterdotcom
Copy link
Contributor

I noticed that all reports change position when drafts are added/removed from them

This is just because the draft moves up in the hierarchy though right? When the message is sent, it doesn't move back down again. If so, I think this is fine.

@parasharrajat
Copy link
Member

Yeah, it does not move back down.

@Krishna2323
Copy link
Contributor

Krishna2323 commented Aug 9, 2023

@parasharrajat @twisterdotcom, why I always have to send proposals on Upwork, I already have 2 jobs assigned to me on Upwork. I have sent a proposal for this one just now, pls let me know if you can help.

Thanks

@twisterdotcom
Copy link
Contributor

You shouldn't have to send a proposal on Upwork anymore. We should automatically send you a contract if we have your Upwork profile saved. Only proposals in GitHub.

@Krishna2323
Copy link
Contributor

@twisterdotcom, but I haven't got any reporter role job for this one...
And the bot always says
"We're missing your Upwork ID to automatically send you an offer for the Reporter role.
Once you apply to the Upwork job, your Upwork ID will be stored and you will be automatically hired for future jobs!"

@thienlnam
Copy link
Contributor

thienlnam commented Aug 9, 2023

@Krishna2323 Can you please email the email address you linked to GH/Upwork to contributors@expensify.com and we can take a look from there?

@Krishna2323
Copy link
Contributor

@thienlnam, email sent, thanks.

@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 10, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Completed task gets re-indexed if edited. [HOLD for payment 2023-08-17] [$1000] Completed task gets re-indexed if edited. Aug 10, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.52-5 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 2023-08-17. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

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:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
  • [@parasharrajat] 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:
  • [@parasharrajat] 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:
  • [@parasharrajat] Determine if we should create a regression test for this bug.
  • [@parasharrajat] 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.
  • [@twisterdotcom] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@Krishna2323
Copy link
Contributor

hi @thienlnam, still haven't received job offer for reporter role.

@parasharrajat parasharrajat mentioned this issue Aug 17, 2023
56 tasks
@parasharrajat
Copy link
Member

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:

Regression Test Steps

  1. Create a task
  2. Set it to complete.
  3. Open the task report and write a draft message but do not send it & observe the sidebar
  4. Verify that the report goes to the top ( but still below pinned reports ).
  5. send the draft message.
  6. Verify that the report stays on top at the same position.

Do you agree 👍 or 👎 ?

@thienlnam
Copy link
Contributor

@Krishna2323 I took a look, and our automation doesn't work with the Upwork custom profile links. You'll have to update your stored upwork link to your regular profile link. Can you paste the below in a comment?

Contributor details
Your Expensify account email: belivethatkg@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~011653c0d62a6dc458

@melvin-bot

This comment was marked as off-topic.

@twisterdotcom
Copy link
Contributor

Payment Summary:

@Krishna2323
Copy link
Contributor

Contributor details
Your Expensify account email: belivethatkg@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~011653c0d62a6dc458

@melvin-bot
Copy link

melvin-bot bot commented Aug 17, 2023

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

@Krishna2323
Copy link
Contributor

@thienlnam, thanks a lot.

@parasharrajat
Copy link
Member

Payment requested.

@JmillsExpensify
Copy link

Reviewed the details for @parasharrajat. Approved for $1,500 payment in NewDot based on the BZ summary above.

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants