superset icon indicating copy to clipboard operation
superset copied to clipboard

fix(superset-frontend): color formats big numbers when value is 0

Open mtrentz opened this issue 1 year ago • 3 comments

SUMMARY

Previously when the value of a BigNumber was zero (falsey) the expression to evaluate colors always got evaluated to false. Meaning that if my condition was number <= 50 and my number was 0, it wouldn't color it. It would work if it was 0.1.

Related to this issue: #21820 Most recent discussion around this PR #23064

TESTING INSTRUCTIONS

  • Tested if colors when BigNumber is zero
  • Tested if still works for negative, floats, and scientific notation numbers like 1e-100

ADDITIONAL INFORMATION

  • [x] Has associated issue:
  • [ ] Required feature flags:
  • [ ] Changes UI
  • [ ] Includes DB Migration (follow approval process in SIP-59)
    • [ ] Migration is atomic, supports rollback & is backwards-compatible
    • [ ] Confirm DB migration upgrade and downgrade tested
    • [ ] Runtime estimates and downtime expectations provided
  • [ ] Introduces new feature or API
  • [ ] Removes existing feature or API

mtrentz avatar Apr 15 '24 15:04 mtrentz

Thanks for opening this!

rusackas avatar Apr 15 '24 17:04 rusackas

@mtrentz thanks for the fix. Would you mind adding unit tests to prevent future regressions?

john-bodley avatar Apr 16 '24 17:04 john-bodley

Hey @john-bodley and @rusackas

I would be happy to contribute with tests but in this case I don't know how.

The logic I've changed is inside the rendering logic and I don't know how to mock render these e-charts. I also could not find any other similar tests that I can use to base myself of when testing this part of the code.

mtrentz avatar Apr 24 '24 15:04 mtrentz