From f86c7a36bde75533827d103886129b29d17c9022 Mon Sep 17 00:00:00 2001 From: baraganio Date: Thu, 4 Apr 2024 21:27:37 +0200 Subject: [PATCH 1/4] Arreglando las respuestas que no traen nombre (traen la etiqueta Q1234) --- questions/creationservice/creation-service.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/questions/creationservice/creation-service.js b/questions/creationservice/creation-service.js index 7fc89323..102d437c 100644 --- a/questions/creationservice/creation-service.js +++ b/questions/creationservice/creation-service.js @@ -34,10 +34,14 @@ function getQuestionInfo(info){ // Select 4 random rows of the data for (let i = 0; i Date: Sun, 7 Apr 2024 23:20:56 +0200 Subject: [PATCH 2/4] Cambiando alguna peticiones post por get --- gatewayservice/gateway-service.js | 8 ++++---- questions/creationservice/creation-service.js | 2 +- questions/retrieveservice/retrieve-service.js | 2 +- webapp/src/components/Game.js | 2 +- webapp/src/components/HistoricalData.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 9399e3a8..82e9f886 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -69,10 +69,10 @@ app.get('/getgamehistory/:username', async (req, res) => { -app.post('/createquestion', async (req, res) => { +app.get('/createquestion', async (req, res) => { try { // Create a petition to the URL (le llegará a creation-service.js) with the option /createquestion and the req.body params - const questionResponse = await axios.post(creationServiceUrl+'/createquestion', req.body); + const questionResponse = await axios.get(creationServiceUrl+'/createquestion', req.body); // Return a json response with what we obtained on the petition res.json(questionResponse.data); } catch (error) { @@ -80,10 +80,10 @@ app.post('/createquestion', async (req, res) => { } }); -app.post('/getquestionshistory', async (req, res) => { +app.get('/getquestionshistory', async (req, res) => { try { // Create a petition to the URL (le llegará a retrieve-service.js) with the option /getgeneratedquestions and the req.body params - const questionResponse = await axios.post(retrieveServiceUrl+'/getquestionshistory', req.body); + const questionResponse = await axios.get(retrieveServiceUrl+'/getquestionshistory', req.body); // Return a json response with what we obtained on the petition res.json(questionResponse.data); } catch (error) { diff --git a/questions/creationservice/creation-service.js b/questions/creationservice/creation-service.js index 102d437c..1243145c 100644 --- a/questions/creationservice/creation-service.js +++ b/questions/creationservice/creation-service.js @@ -77,7 +77,7 @@ async function saveQuestion(){ } } -app.post('/createquestion', async (req, res) => { +app.get('/createquestion', async (req, res) => { selectRandomQuery(); const apiUrl = `https://query.wikidata.org/sparql?query=${encodeURIComponent(queries[randomQuerySelector])}&format=json`; diff --git a/questions/retrieveservice/retrieve-service.js b/questions/retrieveservice/retrieve-service.js index 3ece0bc3..0d65c42a 100644 --- a/questions/retrieveservice/retrieve-service.js +++ b/questions/retrieveservice/retrieve-service.js @@ -11,7 +11,7 @@ const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/questiond mongoose.connect(mongoUri); -app.post('/getquestionshistory', async (req, res) => { +app.get('/getquestionshistory', async (req, res) => { const questions = await Question.find({}); var solution = []; diff --git a/webapp/src/components/Game.js b/webapp/src/components/Game.js index 92c0a98e..cf3017a5 100644 --- a/webapp/src/components/Game.js +++ b/webapp/src/components/Game.js @@ -63,7 +63,7 @@ const Game = () => { const handleShowQuestion = async () => { try{ // It makes a petition to the api and store the response - const response = await axios.post(`${apiEndpoint}/createquestion`, { }); + const response = await axios.get(`${apiEndpoint}/createquestion`, { }); // Extract all the info of the response and store it setQuestionObject(response.data.responseQuestionObject); setCorrectOption(response.data.responseCorrectOption); diff --git a/webapp/src/components/HistoricalData.js b/webapp/src/components/HistoricalData.js index 6e746026..72407410 100644 --- a/webapp/src/components/HistoricalData.js +++ b/webapp/src/components/HistoricalData.js @@ -12,7 +12,7 @@ const HistoricalData = () => { const handleShowHistory = async () => { try{ // It makes a petition to the api and store the response - const response = await axios.post(`${apiEndpoint}/getquestionshistory`, { }); + const response = await axios.get(`${apiEndpoint}/getquestionshistory`, { }); setQuestionsHistory(response.data); }catch (error){ console.error('Error:', error); From 597fe01ee64772f7a3fb5740fec540cd4cb6407f Mon Sep 17 00:00:00 2001 From: baraganio Date: Sun, 7 Apr 2024 23:39:47 +0200 Subject: [PATCH 3/4] Merge con develop --- .github/workflows/release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c9768ee..da48ef08 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,6 +163,4 @@ jobs: wget https://raw.githubusercontent.com/arquisoft/wiq_es2b/master/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_es2b/master/.env -O .env docker compose --profile prod down - docker compose --profile prod up -d --pull always - ->>>>>>>>> Temporary merge branch 2 + docker compose --profile prod up -d --pull always \ No newline at end of file From 668b401a67f64eeaaca1c4533732809d5e3fa80e Mon Sep 17 00:00:00 2001 From: Carlos Sanchez <108028059+baraganio@users.noreply.github.com> Date: Mon, 8 Apr 2024 00:04:50 +0200 Subject: [PATCH 4/4] Update 06_runtime_view --- docs/src/06_runtime_view.adoc | 80 ++++++++++------------------------- 1 file changed, 22 insertions(+), 58 deletions(-) diff --git a/docs/src/06_runtime_view.adoc b/docs/src/06_runtime_view.adoc index e10f375b..c9e002f6 100644 --- a/docs/src/06_runtime_view.adoc +++ b/docs/src/06_runtime_view.adoc @@ -3,63 +3,27 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-runtime-view]] == Runtime View - -[role="arc42help"] -**** -.Contents -The runtime view describes concrete behavior and interactions of the system’s building blocks in form of scenarios from the following areas: - -* important use cases or features: how do building blocks execute them? -* interactions at critical external interfaces: how do building blocks cooperate with users and neighboring systems? -* operation and administration: launch, start-up, stop -* error and exception scenarios - -Remark: The main criterion for the choice of possible scenarios (sequences, workflows) is their *architectural relevance*. It is *not* important to describe a large number of scenarios. You should rather document a representative selection. - -.Motivation -You should understand how (instances of) building blocks of your system perform their job and communicate at runtime. -You will mainly capture scenarios in your documentation to communicate your architecture to stakeholders that are less willing or able to read and understand the static models (building block view, deployment view). - -.Form -There are many notations for describing scenarios, e.g. - -* numbered list of steps (in natural language) -* activity diagrams or flow charts -* sequence diagrams -* BPMN or EPCs (event process chains) -* state machines -* ... - - -.Further Information - -See https://docs.arc42.org/section-6/[Runtime View] in the arc42 documentation. - -**** - -=== - - -* __ -* __ - -It is possible to use a sequence diagram: - -[plantuml,"Sequence diagram",png] +=== User plays a game +When the game is started, the app will call the createquestion service that is in charge of provide generated questions from wikidata information. +[plantuml,"Start a game",png] ---- -actor Alice -actor Bob -database Pod as "Bob's Pod" -Alice -> Bob: Authentication Request -Bob --> Alice: Authentication Response -Alice --> Pod: Store route -Alice -> Bob: Another authentication Request -Alice <-- Bob: another authentication Response +actor a as "User" +participant q as "Game GUI" +participant w as "CreateQuestions service" +database d as "Database" + + +a -> q: Start the game +loop number of questions +q -> w: Ask for a question +w -->q: Returns the question +q -> d: Store the question +q -> a: Returns the question + +a -> q: Pick an answer +q -> a: Shows if the answer was valid or not +a -> q: Asks for next question +end +q -> a: Show the game stats +q -> d: Store the game with questions, answers and stats ---- - -=== - -=== ... - -===