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

[14.0][FIX] date format in bokeh #8

Conversation

ntsirintanis
Copy link

No description provided.

def _format_date(self, date):
if not date:
return ""
return datetime.datetime.strptime(date, "%Y-%m-%d").strftime("W%W %Y")
Copy link
Member

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?

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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:

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?

Copy link
Author

@ntsirintanis ntsirintanis Feb 28, 2024

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

Copy link
Member

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!

@ntsirintanis ntsirintanis force-pushed the 14.0-backport-project_forecast_line_bokeh_chart_empty_plot_fix branch 2 times, most recently from e62f5b0 to a18350c Compare June 27, 2023 14:52
@ntsirintanis ntsirintanis force-pushed the 14.0-backport-project_forecast_line_bokeh_chart branch from c38c785 to cbe5cff Compare January 18, 2024 10:22
@ntsirintanis ntsirintanis force-pushed the 14.0-backport-project_forecast_line_bokeh_chart_empty_plot_fix branch from a18350c to 117dd01 Compare January 18, 2024 10:23
@ntsirintanis ntsirintanis force-pushed the 14.0-backport-project_forecast_line_bokeh_chart_empty_plot_fix branch from 117dd01 to e020bd7 Compare January 18, 2024 10:30
@gjotten gjotten changed the title [FIX] date format in bokeh [14.0][FIX] date format in bokeh Feb 8, 2024
@@ -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
Copy link
Member

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

@ntsirintanis ntsirintanis force-pushed the 14.0-backport-project_forecast_line_bokeh_chart_empty_plot_fix branch from 9643327 to 12f4b21 Compare February 29, 2024 09:19
@ntsirintanis ntsirintanis merged commit 27770f7 into 14.0-backport-project_forecast_line_bokeh_chart Mar 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants