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

Implementation of sorting of requests in Request screen #1082

Merged
merged 6 commits into from
Dec 9, 2023

Conversation

chandel-aman
Copy link
Contributor

@chandel-aman chandel-aman commented Nov 21, 2023

What kind of change does this PR introduce?

Bug

Issue Number:

Fixes #1073

Did you add tests for your changes?

Yes

Snapshots/Videos:

www_screencapture_com_2023-11-22_02_37.webm

If relevant, did you update the documentation?

Summary

  1. Implementation of sorting functionality on Requests Screen.
  2. Sorting of requests can be done on the basis of latest and oldest.
  3. Added the tests for sorting.

Does this PR introduce a breaking change?

Other information

Have you read the contributing guide?

Yes

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (655b6b3) 92.77% compared to head (af20ff6) 94.64%.
Report is 21 commits behind head on develop.

Files Patch % Lines
...rgProfileFieldSettings/OrgProfileFieldSettings.tsx 90.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1082      +/-   ##
===========================================
+ Coverage    92.77%   94.64%   +1.87%     
===========================================
  Files          134      138       +4     
  Lines         3238     3324      +86     
  Branches       904      922      +18     
===========================================
+ Hits          3004     3146     +142     
+ Misses         225      171      -54     
+ Partials         9        7       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@palisadoes
Copy link
Contributor

Thanks.

Please also get the test code coverage for the typescript files you edited up to 100%

We are trying to get back up to 95% coverage overall to ensure the reliability of our code.

src/screens/Requests/Requests.tsx Outdated Show resolved Hide resolved
@chandel-aman
Copy link
Contributor Author

image
@palisadoes Test coverage for Requests.tsx has been increased to 100%. Can this be merged now?

@rishav-jha-mech
Copy link
Contributor

Good work @chandel-aman, please complete the points that I have asked in the review.

@noman2002
Copy link
Member

@rishav-jha-mech Your review is not visible. Please put a comment.

noman2002
noman2002 previously approved these changes Nov 30, 2023
Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@chandel-aman
Copy link
Contributor Author

chandel-aman commented Nov 30, 2023

Good work @chandel-aman, please complete the points that I have asked in the review.

@rishav-jha-mech Could you please comment down the changes that needs to be done?

@chandel-aman
Copy link
Contributor Author

@palisadoes @rishav-jha-mech
Could you please provide the information on what needs to be reviewed?

<Dropdown.Toggle
variant="outline-success"
data-testid="sortuser"
>
<SortIcon className={'me-1'} />
{t('sort')}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here instead of Sort text you should show the selected option, and the sort button should become of variant='success' meaning sorting is active now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

<Dropdown.Item href="#/action-3">Action 3</Dropdown.Item>
<Dropdown.Item
onClick={(): void => handleSorting('latest')}
data-testid="latest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whichever option is selected should be highlighted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@@ -372,6 +418,11 @@ const Requests = (): JSX.Element => {
</Table>
</InfiniteScroll>
)}
{!isLoading && displayedUsers.length === 0 && (
<div className="w-100 text-center my-4">
<h5 className="m-0 ">{t('noRequestFound')}</h5>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this line ?

{t('noResultsFoundFor')} &quot;{searchByName}&quot;

If no request is found for a particular search, the above text should be displayed

@rishav-jha-mech
Copy link
Contributor

Also @chandel-aman you may add time of the request in the table column, and it should be of humanize format, ex 1 Day ago, 4 hours ago, 1 year ago, etc.

@chandel-aman
Copy link
Contributor Author

@rishav-jha-mech Thanks for your review. I'll make the changes that you've suggested.

@chandel-aman
Copy link
Contributor Author

Also @chandel-aman you may add time of the request in the table column, and it should be of humanize format, ex 1 Day ago, 4 hours ago, 1 year ago, etc.

@rishav-jha-mech This is not related to this issue of sorting the requests, should I make a separate issue for this? Also, we only have date for when the user was created not date when the request was made. So do we have to display the user created date in requests?

@rishav-jha-mech
Copy link
Contributor

@chandel-aman then that means that you are sorting on basis of user creation, so add that field in column for now, humanize the date time.

@chandel-aman
Copy link
Contributor Author

@rishav-jha-mech Sure, will do that!

@noman2002
Copy link
Member

@chandel-aman Any update on this? Please get this PR merged, its been more than 2 weeks.

@chandel-aman
Copy link
Contributor Author

@noman2002 I've made all the changes asked in the review. Was facing some issue in test coverage of request screen. I'm working on it; will try getting this PR merged asap.

@chandel-aman
Copy link
Contributor Author

image
Test is 100% covered.

image
Added the time of the request.

image

image

  • Sort button is set to "success" variant when sorting is active.
  • Sort button highlights the type of sorting used.

image
We are still showing the message for user not found for when we are unable to find a searched user.

@rishav-jha-mech @noman2002
All the changes suggested have been implemented. Could you please review the changes and merge this PR.

Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aashimawadhwa
Copy link
Member

LGTM

@aashimawadhwa
Copy link
Member

@palisadoes this can be merged

@palisadoes palisadoes merged commit 044b336 into PalisadoesFoundation:develop Dec 9, 2023
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement sorting on the Request screen
5 participants