We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you stand up a new instance of Ambi, or you truncate the DB tables of all existing data, you'll get an error:
function nil.temperature/0 is undefined
Ambi should handle this error and still display the sensor readings dashboard even when the DB tables are empty.
More details about the error from Phoenix:
The text was updated successfully, but these errors were encountered:
It's looking like an issue in lib/ambi.ex in the get_last_row() function. When there aren't any rows, Repo.one() returns nil:
Repo.one()
defp get_last_row() do Repo.one(from s in Ambi.Reading, order_by: [desc: s.id], limit: 1) end
We need a guard to detect nil and return an empty reading if there aren't any values in the DB.
Another idea is to use Repo.one!() instead and handle the Ecto.NoResultsError runtime error instead. See the Hexdocs for more information.
Repo.one!()
Ecto.NoResultsError
Sorry, something went wrong.
wumbabum
No branches or pull requests
If you stand up a new instance of Ambi, or you truncate the DB tables of all existing data, you'll get an error:
function nil.temperature/0 is undefined
Ambi should handle this error and still display the sensor readings dashboard even when the DB tables are empty.
More details about the error from Phoenix:
The text was updated successfully, but these errors were encountered: