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

Fix task IDs are not sorted on multiple tasks validation sidebar #4695

Merged
merged 1 commit into from
May 31, 2021
Merged

Fix task IDs are not sorted on multiple tasks validation sidebar #4695

merged 1 commit into from
May 31, 2021

Conversation

NatashaKSS
Copy link
Contributor

@NatashaKSS NatashaKSS commented May 30, 2021

Description

This ensures that task IDs on the Validate Multiple Tasks page are sorted in ascending order for a better UX. This PR performs the sort on both the title and the TaskValidationSelector components, so that they are aligned.

Resolves #4689

Implementation Details

Sorting is done on the task IDs array in action.js since that is the array that gets passed into all child components. I thought that placing the sort function there would make it more convenient in the future, so you don't need to worry about having to sort individual child components on their own anymore (the array is sorted, just display).

(Sidenote) Javascript's Array.prototype.sort does a lexicographic sort by default (docs). Since the tasksIds array is a number[], I had to use a custom compare function.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Run yarn start in the ./frontend folder
  • Navigate to the page Manage > Select a project > Contribute > Tasks > Validate (n) Tasks (use a project with multiple pending validation tasks)
  • Verify that tasks with a mix of 2-digit, 3-digit and 4-digit IDs, etc, are rendered in ascending order
  • Run yarn test in the ./frontend folder. There were no unit tests for this file, so I tested my implementation on the UI.

Here is a reference screenshot:

image

@NatashaKSS NatashaKSS marked this pull request as ready for review May 30, 2021 08:50
@willemarcel willemarcel added this to the v4.4.8 milestone May 31, 2021
@willemarcel willemarcel added status: done type: enhancement Improving an existing functionality labels May 31, 2021
Copy link
Contributor

@willemarcel willemarcel left a comment

Choose a reason for hiding this comment

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

Perfect, @NatashaKSS!! Thanks for your awesome collaboration! 🥇

@willemarcel willemarcel merged commit eaaa69f into hotosm:develop May 31, 2021
@NatashaKSS NatashaKSS deleted the fix/4689-order-task-id-multitask-validation branch July 1, 2021 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: frontend status: done type: enhancement Improving an existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order the tasks by id on multiple tasks validation
2 participants