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: use 0 for falsy number progress values during sorting #1444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

enjeck
Copy link
Contributor

@enjeck enjeck commented Nov 7, 2024

Fixes #1441

Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
@enjeck enjeck added the 3. to review Waiting for reviews label Nov 7, 2024
@enjeck enjeck self-assigned this Nov 7, 2024
@@ -16,9 +16,9 @@ export default class NumberProgressColumn extends AbstractNumberColumn {
sort(mode, nextSorts) {
const factor = mode === 'DESC' ? -1 : 1
return (rowA, rowB) => {
const tmpA = rowA.data.find(item => item.columnId === this.id)?.value || null
const tmpA = rowA.data.find(item => item.columnId === this.id)?.value || 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, the problem was the fact that when the row value was 0, we were assigning to null instead of just keeping 0. One 'problem' that still exist is if there are null rows (when user saves without setting a value), they are treated as 0. I imagine the use might expect all null rows to be at the bottom instead.
I also considered using ?? instead of ||, but this doesn't fix this.

Copy link
Member

Choose a reason for hiding this comment

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

The browser console says ?? should do ok:

Screenshot_20241107_225950

Unless the 0 was already casted so bool or such in value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
Status: 🧭 Planning evaluation (don't pick)
Development

Successfully merging this pull request may close these issues.

Sort by progress bar ascending puts 0 progress last
2 participants