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

feat: sort proposals #5675

Merged
merged 23 commits into from Jan 27, 2023
Merged

feat: sort proposals #5675

merged 23 commits into from Jan 27, 2023

Conversation

MarkNerdi996
Copy link
Contributor

Summary

This PR includes different sorting options for proposals

Changelog

- Add `Order` as filteritem
- implement phase ordering
- implement name ordering

Relevant Issues

Closes #5255

Testing

Platforms

Please select any platforms where your changes have been tested.

  • Desktop
    • MacOS
    • Linux
    • Windows
  • Mobile
    • iOS
    • Android

Instructions

Please describe the specific instructions, configurations, and/or test cases necessary to test and verify that your changes work as intended.

...

Checklist

Please tick all of the following boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or modified tests that prove my changes work as intended
  • I have verified that new and existing unit tests pass locally with my changes
  • I have verified that my latest changes pass CI workflows for testing and linting
  • I have made corresponding changes to the documentation

@MarkNerdi996 MarkNerdi996 self-assigned this Jan 26, 2023
@MarkNerdi996 MarkNerdi996 added type:feature Adding a new feature or functionality context:governance stardust Related to the Stardust Protocol labels Jan 26, 2023
Base automatically changed from feat/filter-proposals to develop January 26, 2023 08:51
Copy link
Contributor

@jeeanribeiro jeeanribeiro left a comment

Choose a reason for hiding this comment

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

Just minor code convention changes then it is good to go 😄

Comment on lines 7 to 8
import { isVisibleProposal } from '@contexts/governance/utils/isVisibleProposal'
import { sortProposals } from '@contexts/governance/utils/sortProposals'
Copy link
Contributor

Choose a reason for hiding this comment

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

Both modules can be added to the utils index and then imported in the same line

Suggested change
import { isVisibleProposal } from '@contexts/governance/utils/isVisibleProposal'
import { sortProposals } from '@contexts/governance/utils/sortProposals'
import { isVisibleProposal, sortProposals } from '@contexts/governance/utils'

Comment on lines 2 to 3
export * from './proposal-type.enum'
export * from './proposal-status.enum'
Copy link
Contributor

Choose a reason for hiding this comment

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

just sorting this by alphabetic order

Suggested change
export * from './proposal-type.enum'
export * from './proposal-status.enum'
export * from './proposal-status.enum'
export * from './proposal-type.enum'

isAscending = filter.order.ascDesc === OrderOption.Asc
}

return proposals?.sort((proposal1, propsal2) => orderFunction(proposal1, propsal2, isAscending)) ?? []
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Suggested change
return proposals?.sort((proposal1, propsal2) => orderFunction(proposal1, propsal2, isAscending)) ?? []
return proposals?.sort((proposal1, proposal2) => orderFunction(proposal1, proposal2, isAscending)) ?? []

Copy link
Contributor

@jeeanribeiro jeeanribeiro left a comment

Choose a reason for hiding this comment

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

I pushed the fixes

@jeeanribeiro jeeanribeiro merged commit 0d3300f into develop Jan 27, 2023
@jeeanribeiro jeeanribeiro deleted the feat/sort-proposals branch January 27, 2023 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context:governance stardust Related to the Stardust Protocol type:feature Adding a new feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Add sorting functionality for proposals
3 participants