You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/05/30 00:04:55 UTC

[GitHub] [incubator-superset] michellethomas opened a new pull request #7616: Fixing time comparison to look for past deltas

michellethomas opened a new pull request #7616: Fixing time comparison to look for past deltas
URL: https://github.com/apache/incubator-superset/pull/7616
 
 
   ### CATEGORY
   
   Choose one
   
   - [x] Bug Fix
   - [ ] Enhancement (new features, refinement)
   - [ ] Refactor
   - [ ] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   On a line chart using the advanced analytics with time shift 1 year incorrectly evaluates to 366 days as the delta and as a result shows incorrect data. `parse_human_timedelta` looks forward in time when evaluating the human timedelta to number of days, but it's used in time compare to look back in time and compare current points to a previous delta. Around leap years the number of days 1 year ahead is not the same as 1 year behind. More details of the issue are in #7311 
   
   I'm keeping parse_human_timedelta the way it is and adding another function to specify that we want the past delta (so `-1 year` if we are given `1 year`), and returning a positive timedelta as we were previously. I looked into just making parse_human_timedelta return a negative delta, but it makes the logic below look a bit more confusing with delta =+ parse_human_timedelta(...) when it would actually be subtracting the negative delta.
   
   NOTE: This will change the data for time shift (1 year, 1 month,...) but it will be accurate.
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: fixes #7311 
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   ### REVIEWERS
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org