-
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
unify prediction audios #870
Conversation
lib/content/audio/predictions.ex
Outdated
[ | ||
%__MODULE__{ | ||
prediction: message.prediction, | ||
special_sign: message.special_sign, | ||
terminal?: message.terminal?, | ||
next_or_following: next_or_following | ||
} | ||
] | ||
end | ||
|
||
def from_message(%Content.Message.StoppedTrain{} = message, next_or_following) do | ||
[ | ||
%__MODULE__{ | ||
prediction: message.prediction, | ||
special_sign: message.special_sign, | ||
terminal?: message.terminal?, | ||
next_or_following: next_or_following | ||
} | ||
] |
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.
Since these two clauses are doing the same thing, is it worth separating the struct instantiation into a helper?
lib/content/audio/predictions.ex
Outdated
|
||
cond do | ||
!platform -> {nil, false, nil} | ||
jfk_mezzanine? and minutes > 9 -> {nil, false, :later} |
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 documentation/posterity (although I think the typespec mostly covers that) and avoiding "magic numbers" in code in mind, it might be worthwhile if we swap out 9
and 5
for some module attributes. @announce_platform_later_threshold
and @announce_platform_soon_threshold
or something along those lines?
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.
Looks good!
Summary of changes
This combines the
NextTrainCountdown
,FollowingTrain
, andStoppedTrain
audio modules into one unified module. The goal is to reduce some overlapping logic between these code paths, and pave the way for future refactoring.This includes a slight wording change on JFK platforms readouts, which was ok'd by product and is illustrated with a new test case. The other test deltas are minor capitalization and punctuation changes to TTS strings resulting from standardizing the code, which shouldn't substantially affect the output.