hedwig_trivia v0.1.0 HedwigTrivia.Question View Source
Logic surrounding fetching and evaluating questions from the API
Link to this section Summary
Functions
Returns :ok if the the question is not obviously unanswerable, since the API sometimes returns that.
Call the API to fetch a new question, verify it's playable, and add the data to the game state.
Strip HTML tags from answers. There are definitely better ways to do this, but I'm being very lazy.
Link to this section Functions
Returns :ok if the the question is not obviously unanswerable, since the API sometimes returns that.
Examples
iex> Question.check_worthiness(%{"question" => "asdf", "answer" => "asdf"}) :ok
iex> Question.check_worthiness(%{"question" => "=", "answer" => "asdf"}) :bad
iex> Question.check_worthiness(%{"question" => "=", "answer" => "asdf"}) :bad
Call the API to fetch a new question, verify it's playable, and add the data to the game state.
Strip HTML tags from answers. There are definitely better ways to do this, but I'm being very lazy.