as part of moving to a qids-for-quiz approach (as opposed to embedding falcon, prepware quiz info, etc) with the grs mobile apps:
/Users/smr/current_projects/pws2016/app/controllers/sandbox_controller.rb
/Users/smr/current_projects/pws2016/app/models/quiz_definition.rb
this script generates the json:
http://localhost:3000/sandbox/qidsperc
which you can then save in a file, e.g. qids_per_chapter.json
and embed into the app bundle.
/Users/smr/current_projects/pws2016/app/controllers/sandbox_controller.rb
# qids per chapter def qidsperc quiz_definition = QuizDefinition.find_by_name("Private Pilot, Airplane") qids_per_chapter = quiz_definition.qids_per_chapter() # qids_per_chapter = JSON.pretty_generate(qids_per_chapter) render json: qids_per_chapter end
/Users/smr/current_projects/pws2016/app/models/quiz_definition.rb
def qids_per_chapter chapters = self.book.chapters dict = {} qapc = {} chapters.each { |chapter| chapnum = chapter.chapnum qids = question_ids_for_chapnum(chapnum) # N.B. these are shuffled dict[chapnum] = qids qapc[chapnum] = qids.count } dict[:qapc] = qapc return dict end
http://localhost:3000/sandbox/qidsperc
which you can then save in a file, e.g. qids_per_chapter.json
and embed into the app bundle.
- based on Private Pilot, Airplane
- this is based on a quiz definition so categories are taken into account
- a qapc data structure is baked in
No comments:
Post a Comment