Skip to content

Commit

Permalink
Removed try and catch bc of pr
Browse files Browse the repository at this point in the history
  • Loading branch information
lauratbg committed Apr 16, 2024
1 parent 07fc99c commit 243e280
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions webapp/src/components/questionView/QuestionGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ class QuestionGenerator{

async generateQuestions(lang, type, amount) {

try {
//const response = await fetch(this.apiUrl);
//const receivedQuestions = await response.json();
// try {
// //const response = await fetch(this.apiUrl);
// //const receivedQuestions = await response.json();

//Mockup
console.log("type: "+type+" amount: "+amount)
const receivedQuestions = JSON.parse('{"0":{"question":"¿Cuál es la población de Oviedo?","answers":["225089","191325","220587","121548"]},'+
'"1":{"question":"¿Which is the population of Gijon?","answers":["275274","159658","233982","305554"]},'+
'"2":{"question":"¿Cuál es la población de Avilés?","answers":["82568","115595","41284","122200"]},'+
'"3":{"question":"¿Cuál es la capital de Asturias?","answers":["Ciudad de Oviedo","a","b","c"]},'+
'"4":{"question":"¿Cuál es la capital de España?","answers":["Madrid","a","b","c"]},'+
'"5":{"question":"¿Cuál es la capital de Turquía?","answers":["Ankara","a","b","c"]}}')
// //Mockup
// console.log("type: "+type+" amount: "+amount)
// const receivedQuestions = JSON.parse('{"0":{"question":"¿Cuál es la población de Oviedo?","answers":["225089","191325","220587","121548"]},'+
// '"1":{"question":"¿Which is the population of Gijon?","answers":["275274","159658","233982","305554"]},'+
// '"2":{"question":"¿Cuál es la población de Avilés?","answers":["82568","115595","41284","122200"]},'+
// '"3":{"question":"¿Cuál es la capital de Asturias?","answers":["Ciudad de Oviedo","a","b","c"]},'+
// '"4":{"question":"¿Cuál es la capital de España?","answers":["Madrid","a","b","c"]},'+
// '"5":{"question":"¿Cuál es la capital de Turquía?","answers":["Ankara","a","b","c"]}}')

let i = 0;
var questions = [];
for (const key in receivedQuestions) {
questions[i] = new Question(receivedQuestions[key]);
i += 1;
}
console.log(questions);
return questions;
} catch (error) {
throw new Error(error);
}
// let i = 0;
// var questions = [];
// for (const key in receivedQuestions) {
// questions[i] = new Question(receivedQuestions[key]);
// i += 1;
// }
// console.log(questions);
// return questions;
// } catch (error) {
// throw new Error(error);
// }



Expand Down

0 comments on commit 243e280

Please sign in to comment.