<commit_before>var models = require('../models/models.js');

exports.show=function(req,res){
	models.Quiz.find(req.params.quizId).then(function (quiz){
		res.render('quizes/show',{quiz:quiz});
	});
};

exports.answer=function(req,res){
	models.Quiz.find(req.params.quizId).then(function(quiz){
		if(req.query.respuesta=== quiz.respuesta)
			res.render('quizes/answer',{quiz:quiz, respuesta:'Correcto'});
		else
			res.render('quizes/answer',{quiz:quiz, respuesta:'Incorrecto'});
	});
};

exports.index = function(req,res){
	models.Quiz.findAll().then(function(quizes){
		res.render('quizes/index.ejs',{quizes:quizes});
	});
}<commit_msg>Added search route<commit_after>var models = require('../models/models.js');

exports.show=function(req,res){
	models.Quiz.find(req.params.quizId).then(function (quiz){
		res.render('quizes/show',{quiz:quiz});
	});
};

exports.answer=function(req,res){
	models.Quiz.find(req.params.quizId).then(function(quiz){
		if(req.query.respuesta=== quiz.respuesta)
			res.render('quizes/answer',{quiz:quiz, respuesta:'Correcto'});
		else
			res.render('quizes/answer',{quiz:quiz, respuesta:'Incorrecto'});
	});
};

exports.index = function(req,res){
	if(req.query.search!==undefined){
	var searchStr='%'+req.query.search.replace(' ','%')+'%';
	models.Quiz.findAll({where: ["pregunta like ?", searchStr]}).then(function(quizes){
		res.render('quizes/index.ejs',{quizes:quizes});
	});
	}else{
	models.Quiz.findAll().then(function(quizes){
		res.render('quizes/index.ejs',{quizes:quizes});
	});
	}
}
{'fraction_non_alphanumeric': 0.22390019697964544, 'fraction_numerical': 0.0, 'mean_word_length': 6.582089552238806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4905271', 'n_tokens_mistral': 621, 'n_tokens_neox': 591, 'n_words': 51}