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

Display dashboard actions in correct order #879

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

penk85
Copy link
Contributor

@penk85 penk85 commented Mar 21, 2023

WPC-1118: Dashboard action were displaying in wrong order. This fixes where the sort order in the api wasn't working properly.

@github-actions
Copy link

PR 879 with branch WPC-1118-dashboard-events-sorting has been deployed to:

@@ -138,5 +138,5 @@ export const getActions = async (
await Promise.all([articles, pages, comments, authors, subscriptions, polls, users, events])
).flat()

return actions.sort((v1: Action, v2: Action) => v2.date.getDate() - v1.date.getDate())
return actions.sort((v1: Action, v2: Action) => v2.date.getTime() - v1.date.getTime())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return actions.sort((v1: Action, v2: Action) => v2.date.getTime() - v1.date.getTime())
return actions.sort((v1: Action, v2: Action) => v2.date - v1.date)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Itrulia the sort won't work with Date type so I needed it as a number.

Copy link
Collaborator

@Itrulia Itrulia Mar 22, 2023

Choose a reason for hiding this comment

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

Yeah this will make it a number

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually you're right it should work, but ts shows error.

@penk85 penk85 merged commit e4767e4 into master Mar 22, 2023
@penk85 penk85 deleted the WPC-1118-dashboard-events-sorting branch March 22, 2023 12:22
@tomaszdurka tomaszdurka mentioned this pull request Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants