-
Notifications
You must be signed in to change notification settings - Fork 2
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
JFK umass mezzanine refactor #661
Conversation
…k-umass-mezzanine-refactor
Coverage of commit
|
Coverage of commit
|
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.
See comments, otherwise looks good.
case Signs.Utilities.Predictions.get_messages(predictions, sign) do | ||
{%Content.Message.Empty{}, %Content.Message.Empty{}} -> | ||
get_headway_or_alert_messages(sign, current_time, alert_status) | ||
|
||
{top_message, %Content.Message.Empty{}} -> | ||
{top_message, | ||
get_paging_headway_or_alert_messages(sign, current_time, alert_status, :bottom)} | ||
|
||
{%Content.Message.Empty{}, bottom_message} -> | ||
if match?( | ||
%Content.Message.Predictions{station_code: "RJFK", zone: "m"}, | ||
bottom_message | ||
) do | ||
jfk_umass_headway_paging(bottom_message, sign, current_time, alert_status) | ||
else | ||
{get_paging_headway_or_alert_messages(sign, current_time, alert_status, :top), | ||
bottom_message} | ||
end | ||
|
||
messages -> | ||
messages | ||
end |
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.
Thinking out loud: This logic looks correct, and I think it's in a good state for now, but it's definitely hinting at a different way of framing the problem. E.g. "for each route, generate a prediction/headway/alert message, then lay them out so they fit." (This is more or less what I mentioned before, just reiterating it in context)
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.
Agreed although, I don't think I have as clear of an idea how that different approach would look in practice. I'd like to hear in more detail about how you're envisioning things! Let's chat soon about it
flip? = flip?(messages) | ||
|
||
if flip?, |
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.
nit:
flip? = flip?(messages) | |
if flip?, | |
if flip?(messages), |
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.
I may leave this one for now in as I re-use the flip?
variable in a couple more places in the subsequent PR
{%Content.Message.GenericPaging{ | ||
messages: [ | ||
# Make zone nil in order to prevent the usual paging platform message | ||
%{prediction | zone: nil}, |
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.
With this prediction message nested inside the generic paging message, the countup?
logic won't trigger as usual. We need to expand that logic if we want it to keep working for this case.
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.
Ah great catch, thank you!
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.
@panentheos just pushed some changes to expand the countup logic. Mind taking another quick pass? 🙏
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.
There may be a larger issue here, if I'm reading this correctly: In the JFK special case, there's an implicit flip happening; the non-empty prediction comes from the bottom, but in the full-page rendering is embedded on top. Because the caller of same_content?
always compares top-to-top and bottom-to-bottom, we have no way of matching up the corresponding predictions in that case. The upshot is that as we transition in/out of the special case, we might let a count-up slip through. Does that sound right?
I think addressing that would require a substantial refactor of the same_content?
calculation, which seems overly risky right now. My inclination is to document this issue with a comment, and address it in a future change. Thoughts?
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.
Ohh hm yes, I think that's correct. We can't match up the predictions when we're transitioning between the two formats and would potentially miss a count-up.
Alternatively, I think we could get around having to do a more substantial refactor by mapping the PlatformPredictionBottom
struct to a regular Prediction
struct before calling countup?
again. I think it should be a safe assumption that the destinations are the same (:alewife
) since this is such a specific case, or we could also just pass along the destination
when we create the PlatformPredictionBottom
struct. We already pass along the minutes to the bottom so we would have all the pieces handy for the countup logic to do its thing.
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.
Yeah, I guess that works, as long as we call out with a comment that it's tailored for the special case.
Coverage of commit
|
Coverage of commit
|
Summary of changes
The JFK/UMass Mezzanine case where the top line (SB) is on headways while the bottom line is on a prediction was not handled in the previous version and would try to page the prediction on the top line while showing paging headways on the bottom line. This would surpass the character limit for the top line.
This PR takes advantage of some of the new code added for the Early AM Predictions suppression to handle this case.