-
Notifications
You must be signed in to change notification settings - Fork 9
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
Dealing with "overnight" periods #1017
Conversation
web/themes/new_weather_theme/templates/partials/daily-forecast-list-item.html.twig
Outdated
Show resolved
Hide resolved
web/themes/new_weather_theme/templates/partials/daily-forecast-list-item.html.twig
Outdated
Show resolved
Hide resolved
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.
Eng approved
web/modules/weather_blocks/src/Plugin/Block/Test/EndToEnd/DailyForecast/DailyForecast.php.test
Outdated
Show resolved
Hide resolved
web/themes/new_weather_theme/templates/partials/daily-high-low.html.twig
Show resolved
Hide resolved
web/themes/new_weather_theme/templates/partials/daily-high-low.html.twig
Outdated
Show resolved
Hide resolved
web/themes/new_weather_theme/templates/partials/daily-forecast-list-item.html.twig
Outdated
Show resolved
Hide resolved
@partly-igor double check the most recent push, I think I addressed the styling issues properly? |
web/themes/new_weather_theme/templates/partials/daily-forecast-list-item.html.twig
Outdated
Show resolved
Hide resolved
-- What Previously, we were setting the $now value _after_ we had already attempted to filter future daily periods. This prevents us from having any injection of a different $now value for testing purposes and having it filter appropriately. It was also not mapping to the correct timezone, which we have changed.
0d9da6a
to
ba6186d
Compare
This PR modifies theme Javascript or CSS assets but does not update the theme libraries file. Did you mean to update the appropriate version information in the libraries file? |
This PR modifies theme Javascript or CSS assets but does not update the theme libraries file. Did you mean to update the appropriate version information in the libraries file? |
What does this PR do? 🛠️
In #885 we discovered that under certain conditions (see below), a user could see three "today" periods for the daily forecast, in addition to the normally expected one or two periods (day/night).
The new period called "overnight" corresponds to the period midnight to 6am for the location. If the user is looking at the weather for a location whose current time (at the location) is between those hours, they will see this additional overnight period. We caught this by looking at Hawaii from the east coast before noon.
This PR addresses the overarching issue (display the information in a better way), while dealing with many under the hood changes / newly discovered bugfixes that make it possible.
What does the reviewer need to know? 🤔
Added Honolulu bundles for testing
We have added some slightly modified bundles from Honolulu -- where the issue was first noticed -- to the testing and e2e example sets. These will be used only in automated testing.
DailyForecastTrait future days filtering and testing
$now
from block buildWe have slightly altered how we filter out future daily periods. Previously, the
$now
time was computed after these filtration, meaning that the current user's time in their own timezone was always being used as the cutoff. This prevented accurate testing of the overnight period issue.Additionally, the
DailyForecastBlock
'sbuild()
method now takes a$now
DateTime as an optional parameter, and passes it down to the helper methods. The e2e test added in this PR makes use of that.Can't see live in the browser with the bundle alone
Unlike all our other cases of testing with bundles, you will not be able to "see" the overnight period even when looking at the example bundle unless you look between midnight and 6am of the current day. This is because the bundler dates are all relative to the current time, and there is no way from the outside to force the Drupal application to pretend the current time is anything other than what it really is.
Updates to computing high/low
Because the "today" period can have three periods, determining the high/low by day/night is now more ambiguous. Instead, we have adjusted all calculation of high/low to simply take the highest and lowest temperatures returned for each daily period. In most cases the day will still be the high and the night will still be the low. This does not make use of the corresponding hourly data.
Extended periods might only have a "high" value
When there is an "overnight" period, it is not added as an extra period to the number that the API usually provides. This means that the last daily period returned by the API only has a daytime component, the result being we can only display a "high" for that extended day (see third screenshot below).
Closes
#885
Screenshots (if appropriate): 📸
Before:
After:
Extended high-only example: