Skip to content

Commit

Permalink
Merge pull request #44 from Arquisoft/luis
Browse files Browse the repository at this point in the history
Añadida respuesta correcta a la pregunta de capital del pais
  • Loading branch information
uo283055 authored Feb 22, 2024
2 parents 7d24723 + 7e3f637 commit 45509d5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion webapp/src/components/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Link from '@mui/material/Link';
const Game=() =>{
const [questionBody, setquestionBody] = useState('');//pregunta aleatoria cuerpo
const [informacionWikidata, setInformacionWikidata] = useState('');
const [respuestaCorrecta, setRespuestaCorrecta] = useState('');
const [questionType, setQuestionType] = useState('');;//para el tipo de pregunta a buscar
const [answerType, setAnswerType] = useState('');;//para el tipo de respuesta a buscar

Expand Down Expand Up @@ -44,9 +45,10 @@ const Game=() =>{
try {
// Consulta SPARQL//obtengo
const sparqlQuery = `
SELECT ?country ?countryLabel
SELECT ?country ?countryLabel ?capital ?capitalLabel
WHERE {
?country wdt:P31 wd:Q6256. # P31 instancias de -> wd:Q6256 (país)
?country wdt:P36 ?capital. # P36 instancias de -> ?capital (capital)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es".
}
Expand Down Expand Up @@ -75,6 +77,8 @@ const Game=() =>{

setInformacionWikidata(result.countryLabel.value+`?`);

setRespuestaCorrecta(result.capitalLabel.value);

} else {
console.error("Error al realizar la consulta en Wikidata. Estado de respuesta:", respuestaWikidata.status);
}
Expand Down Expand Up @@ -112,6 +116,9 @@ const Game=() =>{
Generar pregunta
</Button>
</div>
<Button variant="contained" color="primary" size="large">
{respuestaCorrecta}
</Button>
</div>
);
}
Expand Down

0 comments on commit 45509d5

Please sign in to comment.