samedi 27 décembre 2014

Can't find a way to create a "working" quiz angular app

I spent the last 2 months trying to create a basic quiz app with Angular (and Ionic, but this is marginal).


The target is a mobile app that work offline. The original version is a Rails app currently live and working fine.


The app is a quiz app and I have my questions inside a json file. Every question has a format like this:



{
"id":5305,
"quiz_type":"oltre",
"text":"Cosa indica Zo?",
"flagged":false,
"image":{
"image":{
"url":"/images/fallback/default.png"
}
},
"section":{
"id":6,
"name":"Navigazione",
"icon":{
"icon":{
"url":"/uploads/section/icon/6/bussola.jpg"
}
}
},
"answers":[
{
"id":5182,
"text":"La differenza tra alta e bassa marea sizigiale",
"correct":false
},
{
"id":5183,
"text":"La differenza tra bassa marea sizigiale ed il livello medio del mare",
"correct":true
},
{
"id":5184,
"text":"La differenza tra il livello medio del mare e l'alta marea",
"correct":false
}
]
}


The app is simple: the app generates a quiz taking a predefined number of random questions using some filters: section, quiz_type. I want also to give the opportunity to include in the random "choice" question with more errors (in the previous quizzes).


My first tentative is with PouchDB: every question is a json document. But I have the problem of the random records: I cannot have random record from one or more than one category using Pouch.


So I switch to SQLite. I create a small import script that read the json and write my DB. It works with about 200 records, then the console begin to give me contraint errors and the question table disappear.


Now I'm trying to use the json as question "db" and to create a track object inside the browser local storage where I save errors, tentative and for every category I add an array with the IDs of my questions.


Anyone has another idea?


Aucun commentaire:

Enregistrer un commentaire