-
Notifications
You must be signed in to change notification settings - Fork 1
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
[14.0][FIX] date format in bokeh #8
[14.0][FIX] date format in bokeh #8
Conversation
def _format_date(self, date): | ||
if not date: | ||
return "" | ||
return datetime.datetime.strptime(date, "%Y-%m-%d").strftime("W%W %Y") |
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.
Haha, yeah, this will solve it for week granularity :-) but for the month view for example it will be translated in the customer language, so it will be harder to replicate it like this.
Did you consider the version whereby we just display all the items in the dict in the right order, instead of querying for specific keys?
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.
yes, I am trying to make as few changes as possible, and mostly this is an exercise to prove to myself that this error had nothing to do with libraries etc. Which it does not, apparently. I am still wondering however how this stopped working out of a sudden.
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.
My take on it was that it actually came into being because of a change you made - the backporting of the _range
thing from 15.0 to 14.0. If we would make a slightly bigger change to not query for exact keys, it means we could scrap that backport, and actually end up with less custom code.
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.
@thomaspaulb please advise here, because I tried a couple of things and nothing works.
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.
My rough idea was that if we:
-
make sure that groupdata comes out sorted by date
-
change this regular dict to be an
OrderedDict
Then, here we can change:
forecast = data[employee][project]
plot_data[project] = [
forecast.get(self._format_date(date), 0) for date in dates
]
to
forecast = data[employee][project]
plot_data[project] = [f for f in forecast]
This should work unless forecast
contains more dates than what gets placed in dates
as returned from _get_time_range()
; in that case, it will become more complicated. Still not impossible I think, but maybe first see if this will work.
Is this along the lines of what you tried? If not, what did you do?
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.
@thomaspaulb it took me a while but the solution was there, right in front of me. Adding an additional key in read_group() result solved everything. @gjotten tested this, let's wait for few more tests and then we can merge
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.
That also seems like a nice solution!
e62f5b0
to
a18350c
Compare
c38c785
to
cbe5cff
Compare
a18350c
to
117dd01
Compare
117dd01
to
e020bd7
Compare
@@ -38,6 +38,9 @@ def _read_group_raw( | |||
if group.get(df): | |||
range_from, range_to = group[df][0].split("/") | |||
group["__range"][field_name] = {"from": range_from, "to": range_to} | |||
# Inject another key in the result |
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.
... for easy access later when we need to display this date
9643327
to
12f4b21
Compare
27770f7
into
14.0-backport-project_forecast_line_bokeh_chart
No description provided.