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

Implement sorting on the organizations screen #1072

Closed
aashimawadhwa opened this issue Nov 17, 2023 · 5 comments · Fixed by #1076
Closed

Implement sorting on the organizations screen #1072

aashimawadhwa opened this issue Nov 17, 2023 · 5 comments · Fixed by #1076
Assignees
Labels
bug Something isn't working feature request no-issue-activity No issue activity

Comments

@aashimawadhwa
Copy link
Member

Describe the bug
Currently sorting is not implemented in the organization screen, the aim is to implement the sort functionality with latest first, oldest first etc. options, you can refer from the posts screen.

To Reproduce
Steps to reproduce the behavior:

  1. login into the talawa admin dashboard
  2. go to the orglist
  3. navigate the sort button
  4. see the issue

Expected behavior
sorting of organization on the basis of defined and selected attributes.

Additional details
NA
Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship PalisadoesFoundation/talawa#359

@github-actions github-actions bot added bug Something isn't working unapproved labels Nov 17, 2023
@akhilender-bongirwar
Copy link
Contributor

@aashimawadhwa, I would like to work on this issue. Please assign me :).

akhilender-bongirwar added a commit to akhilender-bongirwar/talawa-admin that referenced this issue Nov 19, 2023
Changes Made:
- Added a new state variable, `sortingOption`, to manage the current sorting preference. Default is set to 'latest'.
- Introduced a sorting mechanism using the `sortOrgs` function that sorts organizations based on creation date.
- Updated the `useEffect` hook to apply sorting when either `orgsData` or `sortingOption` changes.
- Added two sorting options - latest first and oldest first
- Also added the relevant tests for the correct functionality of the changes.

Fixes issue PalisadoesFoundation#1072

Signed-off-by: Akhilender <[email protected]>
Copy link

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

@github-actions github-actions bot added the no-issue-activity No issue activity label Nov 28, 2023
akhilender-bongirwar added a commit to akhilender-bongirwar/talawa-admin that referenced this issue Dec 5, 2023
Changes Made:
- Added a new state variable, `sortingOption`, to manage the current sorting preference. Default is set to 'latest'.
- Introduced a sorting mechanism using the `sortOrgs` function that sorts organizations based on creation date.
- Updated the `useEffect` hook to apply sorting when either `orgsData` or `sortingOption` changes.
- Added two sorting options - latest first and oldest first
- Also added the relevant tests for the correct functionality of the changes.

Fixes issue PalisadoesFoundation#1072

Signed-off-by: Akhilender <[email protected]>
@lakshz
Copy link
Contributor

lakshz commented Dec 11, 2023

@akhilender-bongirwar Hey, are you working on this?

@github-actions github-actions bot removed the no-issue-activity No issue activity label Dec 12, 2023
@akhilender-bongirwar
Copy link
Contributor

@LakshyaSatpal, please check this PR #1076

akhilender-bongirwar added a commit to akhilender-bongirwar/talawa-admin that referenced this issue Dec 12, 2023
Changes Made:
- Added a new state variable, `sortingOption`, to manage the current sorting preference. Default is set to 'latest'.
- Introduced a sorting mechanism using the `sortOrgs` function that sorts organizations based on creation date.
- Updated the `useEffect` hook to apply sorting when either `orgsData` or `sortingOption` changes.
- Added two sorting options - latest first and oldest first
- Also added the relevant tests for the correct functionality of the changes.

Fixes issue PalisadoesFoundation#1072

Signed-off-by: Akhilender <[email protected]>
Copy link

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

@github-actions github-actions bot added the no-issue-activity No issue activity label Dec 23, 2023
palisadoes pushed a commit that referenced this issue Dec 27, 2023
* feat: Implemented orglist sorting functionality

Changes Made:
- Added a new state variable, `sortingOption`, to manage the current sorting preference. Default is set to 'latest'.
- Introduced a sorting mechanism using the `sortOrgs` function that sorts organizations based on creation date.
- Updated the `useEffect` hook to apply sorting when either `orgsData` or `sortingOption` changes.
- Added two sorting options - latest first and oldest first
- Also added the relevant tests for the correct functionality of the changes.

Fixes issue #1072

Signed-off-by: Akhilender <[email protected]>

* fix: Removed redundancy

- Removed the new interface instead imported the existing interface.
- Added cleanup function in tests.

Signed-off-by: Akhilender <[email protected]>

* fix: Highlighted the selected option

- Ensured that the selected option is highlighted in the sort dropdown.
- Made changes to ensure proper translation.
- Changed the variant from "outline success" to "success" when the option is selected,
  making it feasible for the user to know that the option is applied.

Signed-off-by: Akhilender <[email protected]>

* Removed redundant code

- Removed extra state variable and combined the two state variables into one
  as they perform same functionality.

Signed-off-by: Akhilender <[email protected]>

* fixed the failing test

Signed-off-by: Akhilender <[email protected]>

* Update en.json

- Changed the sort option titles
   - Latest first to Latest
   - Oldest first to Earliest

* fix: Translations modified

- Ensured correct translations for oldest first to earliest and latest first to latest in all languages

Signed-off-by: Akhilender <[email protected]>

* fixed the failing test

Signed-off-by: Akhilender <[email protected]>

* feat: Implement server-side sorting for organizations

Instead of handling sorting on the client side the GraphQL query for fetching organizations (`ORGANIZATION_CONNECTION_LIST`)
has been enhanced to support ordering based on the `createdAt` field.

- Modified the GraphQL query in `ORGANIZATION_CONNECTION_LIST` to include the `orderBy` parameter.
- Updated the `handleSorting` function to trigger a server-side refetch with the appropriate sorting order.
- Removed the client-side sorting logic in the `sortOrgs` function, as sorting is now handled on the server.
- Corrected the graphql schema for OrganizationOrderByInput enum

Signed-off-by: Akhilender <[email protected]>

* Fix: fixed the failing test

Signed-off-by: Akhilender <[email protected]>

* fix: Changed oldest to earliest

- Altered the oldest key to earliest to avoid confusion

Signed-off-by: Akhilender <[email protected]>

---------

Signed-off-by: Akhilender <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature request no-issue-activity No issue activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants