Skip to content

Commit

Permalink
Actualizados los diagramas y doc al estado actual del proyecto
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro-C-M committed Mar 12, 2024
1 parent 3004f2c commit 5d1e0bd
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 22 deletions.
Binary file added docs/images/06-generateQuestion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/06-loginSecuencia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/06-nextQuestion.png
Binary file not shown.
Binary file modified docs/images/06-registerSecuencia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/07-diagramaDespliegue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/Sin título.png
Binary file not shown.
17 changes: 7 additions & 10 deletions docs/src/06_runtime_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ image::06-loginSecuencia.png["Login secuence diagram image"]

=== Request a question

image::06-nextQuestion.png["NextQuestion secuence diagram image"]

1. The user asks for a new question
2. The app redirects that request to the QuestionGenerator
3. The QuestionGenerator generates a heather for the question
4. The QuestionGenerator requests the correct answer to WikiData
5. WikiData sends that answer data
6. The QuestionGenerator builds the question with the answer and wrong options
7. The built question is sent to the app
8. The app shows the question to the User
image::06-generateQuestion.png["NextQuestion secuence diagram image"]

1. The QuestionService wants to generate a question
2. It requests all the necesary info to build a question to WikiData
3. WikiData responds with the requested data
4. The QuestionService builds the question with the data recieved
5. Finally the QuestionService writes the new question in the QuestionsDB
12 changes: 6 additions & 6 deletions docs/src/07_deployment_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ ifndef::imagesdir[:imagesdir: ../images]
== Deployment View


image::07-diagramaDespliegue.png["Building Block general diagram"]
image::07-diagramaDespliegue.PNG["Building Block general diagram"]

Basically when a user wants to use the application, using his web browser
he can connect to the application server where the web app will use some
services also alocated there such as the QuestionGenerator or the LoginManager.
Also these services make use of the WikiData API and database and also of
a database unique for the application to save things as player statistics
or info of them.
he can connect to the application server that is a VM in hosted in Azure
orientated to microservices. That means that all the modules inside it
are dockerized in a container. The QuestionGenerator interacts with WikiData
throught their API and we have also two MongoDB databases one for users
and another to store questions.
11 changes: 5 additions & 6 deletions webapp/src/components/QuestionArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ export function QuestionArea(){
const [respuestas, setRespuestas] = useState([]);
// Estado que almacena la correcta
const [correcta, setCorrecta] = useState();
/**

// Función para llamar al servicio y obtener los datos de la pregunta
const fetchQuestionData = async () => {
try {
// Llamada al servicio para obtener los datos de la pregunta (aquí asumiendo que el servicio devuelve un JSON)
const response = await axios.get(`${apiEndpoint}/getQuestion`);
const data = response.data;
setQuestionData(data); // Actualizar el estado con los datos de la pregunta obtenidos del servicio
//Meto la correcta
setCorrecta(data.correcta);
//calcular respuestas
const respuestasArray = [data.correcta, data.respuestasIncorrecta1, data.respuestasIncorrecta2, data.respuestasIncorrecta3];
setRespuestas(respuestasArray);
Expand All @@ -35,8 +36,8 @@ export function QuestionArea(){
useEffect(() => {
fetchQuestionData();
}, []); // El array vacío asegura que esto solo se ejecute una vez al montar el componente
*/

/** PARA DEPURACIÓN Y LOCAL
useEffect(() => {
const dataDev = {
"pregunta": "What is the capital of France?",
Expand All @@ -56,9 +57,7 @@ useEffect(() => {
setRespuestas(respuestasDev);
setCorrecta(correctaDev);
}, []);

//const respuestas = [questionJson.correcta,questionJson.respuestasIncorrecta1,questionJson.respuestasIncorrecta2,questionJson.respuestasIncorrecta3];

*/

return(
<Box alignContent="center" bg="#0000004d" display="flex" flexDir="column"
Expand Down

0 comments on commit 5d1e0bd

Please sign in to comment.