You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Big WIP commit:
- New question now returns within a category
- Breaking API updates to adopt new model
- Games now have categories when created (stupid ugly JSON to string
patch)
- Fixed Question’s enum’s string to integer issue (DBs are not
migratable, please db:reset and seed for new change).
- Seed data now randomize categories for each question
A) Check if questions within the category and within the game are the same size (i.e. all questions have been asked on category)
A.1) If so, return a question within the game's question pool (still within the same category).
A.2) If no, randomize a unique question
A.3) Add new question to game's question pool
B) return the randomized question
or in Ruby:
defnew_question(category)# if no new question is availableifQuestion.where(category: Question.categories[category]).count <= questions.where(category: Question.categories[category]).countquestion=questions.where(category: Question.categories[category]).sampleelsequestion=loopdoqq=Question::random_question(category)# prefer a unique question for our gamebreakqqunlessquestions.include?qqendquestions << questionunlessquestion.nil?endquestionend
No description provided.
The text was updated successfully, but these errors were encountered: