-
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
fix: nil check in logging conditional #1860
Conversation
Coverage of commit
|
@@ -56,7 +56,7 @@ defmodule Screens.V2.CandidateGenerator.Widgets.TrainCrowding do | |||
params |> Map.to_list() |> fetch_alerts_fn.() do | |||
next_train_prediction = List.first(predictions) | |||
|
|||
if logging_options.is_real_screen do | |||
if not is_nil(next_train_prediction) and logging_options.is_real_screen 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.
nit: I personally like if next_train_prediction && logging_options.is_real_screen do
better for the brevity, but just personal preference. Not sure if using is_nil/1
is more idiomatic though
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 could've sworn I tried that earlier, but the problem is I was using and
instead of &&
... Thanks for the suggestion cause I definitely like this better.
Coverage of commit
|
Coverage of commit
|
Asana task: ad-hoc
I forgot to check
next_train_prediction
fornil
when logging. This is causing a good amount of errors overnight when all predictions arenil
.