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

Number getComparableValue with maximumFractionDigits tests, fix. #192

Merged

Conversation

programmer4web
Copy link
Contributor

@programmer4web programmer4web commented Jun 20, 2018

fixes: #176

  1. Implemented Test: item with age: 46.768 and amount: 2581 should be in the filtered items when filtering from 46.76 to 46.76 Done.

  2. In cosmoz-omnitable-column-number.html added getComparableValue and added the check for minimumFractionDigits. Value is truncated to the specified decimals (2 in the test). Done.

  3. Rebased on latest changes from master. Done.

  4. Replaced minimumFractionDigits with maximumFractionDigits in column and range test. Done.

  5. Implement Test: If we filter out values between 46,75 - 46,76, we shouldn't show a value with 46,768 since it's outside the range. Done.

  6. restore toFixed to round up instead of truncate to n digits. Done.

  7. Implement test: But we should show 46,75xx. Done.

  8. Verify if: However, if 46,768 is displayed as 46,76 then that's the error, it should be 46,77. Done.

@programmer4web programmer4web force-pushed the feature/NEOV-239-filtering-with-decimals branch 2 times, most recently from ad1cbce to 137c4da Compare June 25, 2018 12:09
@programmer4web programmer4web changed the title [WIP] filter comparision uses minimumFractionDigits getComparableValue with minimumFractionDigits Jun 25, 2018
@programmer4web
Copy link
Contributor Author

@nomego @JockeCK @megheaiulian This is ready for review.

return;
}

const decimals = this.minimumFractionDigits;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be maximumFractionDigits ? (We need min/max fraction tests obviously)
Why do we need the pow/parseInt? Aren't we passed this JS float stuff with .toFixed()? :)

Copy link
Contributor Author

@programmer4web programmer4web Jul 4, 2018

Choose a reason for hiding this comment

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

@nomego in the issue: #176
we have the: " 46,768 value with two decimals is 46,76

The user sets both to and from filter as 46,76.
This results that at least not the row with the value 46,768 is not shown."

My answer is: I have tried with toFixed but it rounds up the value (to "46.77" and this value is not in the 46.76 interval ). We need to truncate to two decimals without rounding.
https://stackoverflow.com/questions/4187146/truncate-number-to-two-decimal-places-without-rounding

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, now I get it! And I wonder if the case was actually correct to begin with.
If we filter out values between 46,75 - 46,76, we shouldn't show a value with 46,768 since it's outside the range. However, if 46,768 is displayed as 46,76 then that's the error, it should be 46,77. But we should show 46,75xx.

Problem is with 46,7499 - it's outside the range but will be represented as 46,75. Same with 46,760001. I guess we should consider them 46,75 and include them, but that warrants rounding, not cutting off digits.

@nomego
Copy link
Contributor

nomego commented Jul 2, 2018

Also needs rebase

@programmer4web programmer4web changed the title getComparableValue with minimumFractionDigits [WIP] getComparableValue with minimumFractionDigits Jul 4, 2018
@programmer4web programmer4web force-pushed the feature/NEOV-239-filtering-with-decimals branch from 137c4da to a25b09b Compare July 4, 2018 09:29
@programmer4web programmer4web changed the title [WIP] getComparableValue with minimumFractionDigits getComparableValue with maximumFractionDigits test, fix. Jul 4, 2018
@programmer4web programmer4web changed the title getComparableValue with maximumFractionDigits test, fix. [WIP] getComparableValue with maximumFractionDigits tests Jul 5, 2018
@programmer4web programmer4web changed the title [WIP] getComparableValue with maximumFractionDigits tests Number getComparableValue with maximumFractionDigits tests, fix. Jul 5, 2018
Copy link
Collaborator

@megheaiulian megheaiulian left a comment

Choose a reason for hiding this comment

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

Look good to me!

@programmer4web
Copy link
Contributor Author

@nomego I have implemented some tests from your latest review. Also I have used toFixed again. This is ready for review.

@megheaiulian megheaiulian force-pushed the feature/NEOV-239-filtering-with-decimals branch from 713370c to d4aebaf Compare August 14, 2018 04:21
@megheaiulian
Copy link
Collaborator

Needs a rebase after #195 is merged.

@megheaiulian megheaiulian force-pushed the feature/NEOV-239-filtering-with-decimals branch from d4aebaf to 0c7a246 Compare August 14, 2018 12:10
@megheaiulian megheaiulian force-pushed the feature/NEOV-239-filtering-with-decimals branch from 0c7a246 to 96aa216 Compare August 14, 2018 12:20
@nomego nomego merged commit 0dcad37 into Neovici:master Aug 14, 2018
@megheaiulian megheaiulian deleted the feature/NEOV-239-filtering-with-decimals branch September 10, 2018 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtering with hidden decimals
3 participants