-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
More intuitive display of negative time deltas (#8274) #8276
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8276 +/- ##
==========================================
+ Coverage 67.72% 67.73% +0.01%
==========================================
Files 451 451
Lines 22674 22678 +4
Branches 2370 2370
==========================================
+ Hits 15355 15360 +5
+ Misses 7182 7181 -1
Partials 137 137
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments. Also, do check out #8136 which might be relevant for you. I don't think it properly works in all charts yet, but if this is something that more people find useful I could probably work on improving support for durations.
Thanks for the quick review and helpful comments 👍 . They definitely improved the code. #8136 looks quite interesting and useful to my use case (described in the linked issue). Will play around with it when I find some time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not catching this last pass, but having a more verbose name might be more clear. Other than that LGTM 👍
This is a known unrelated issue; I kicked off CI again. |
@villebro Thanks! Unfortunately, now it's the cypress-dashboard test (which passed in the previous built) with a similar unrelated timeOut issue: 1) Dashboard top-level controls should allow chart level refresh:
CypressError: Timed out retrying: cy.wait() timed out waiting 5000ms for the 1st request to the route: 'postJson_8_force'. No request ever occurred. Are there anymore changes I need to make before this pull request can be approved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'm not an expert on negative time durations, but this might be something that should be brought to the attention of the python core devs.
CATEGORY
Choose one
SUMMARY
This pull request changes the way negative time delta's are displayed. The default python display of a negative timedelta is rather unintuitive for a user of a dashboard. For example, -6 minutes is displayed as
'-1 day, 23:54:00
. This basically requires users to make time calculations in their heads to interpret the number correctly. This pull request changes the formatting to '-0:06:00' at the code level and-0 days 00:06:00
at the superset UI level to make it easier for users to interpret the time delta. More details on the issue and why this solution was chosen can be found in #8274 .BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
The data in postgres looks like this:

Before this pull request the data looks like this in superset:

Afterwards it looks like this in superset:

TEST PLAN
timedelta_f
which is called in base_json_conv() (same module). A new test has been added to test this formatting function.ADDITIONAL INFORMATION
REVIEWERS