Skip to content

Commit

Permalink
Merge branch 'master' into documentation_final_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelMH1 committed May 3, 2024
2 parents 521215f + 85ae33f commit 109d0a6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@

This is a repo for the [Software Architecture course](http://arquisoft.github.io/) in [2023/2024 edition](https://arquisoft.github.io/course2324.html) composed of the following components.

- **Game service**.
- **Game service**. Express server that mainly send requests from gateway to question generator service
- **Gateway service**. Express service that is exposed to the public and serves as a proxy to the two previous ones.
- **Question service**.
- **Store question service**.
- **Question Generator service**. Express service that is going to generate the questions based on the wikidata information and the parameters given by the user
- **Store question service**. Express service that is going to store all the generated questions
- **User service**. Express service that handles the insertion of new users in the system.
- **Auth service**. Express service that handles the authentication of users.
- **User stats service**.
- **User stats service**. Express service that is going to store all the users data so we are going to be able to access to it later
- **Api's Gateway Service** Express service that is exposed to check the users information and the questions generated
- **Wikidata Extractor Service** Express service that extracts and update information from wikidata to a related topic each 30 minutes
- **Webapp**. React web application that uses the gateway service to allow basic login and new user features.


Expand Down
Binary file modified webapp/public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion webapp/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>WIQEII</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/components/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Button from './Button'
import { Footer } from './footer/Footer';
import { Nav } from './nav/Nav';
import axios from 'axios';
import { generateGameId } from './Util';

const apiEndpoint = process.env.REACT_APP_API_ENDPOINT|| 'http://localhost:8000';

Expand All @@ -31,7 +32,8 @@ const Menu = () => {
}

const initiateCalculator = async () => {
navigation("/calculator")
let gameId = await generateGameId();
navigation("/calculator", {state: {gameId}})
}

return (
Expand Down
16 changes: 10 additions & 6 deletions webapp/src/components/game/Calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ import { Container, Typography, Box, LinearProgress } from '@mui/material';
import { Footer } from '../footer/Footer';
import { Nav } from '../nav/Nav';
import Button from '../Button';
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';

let questions = [];
let load = true;
const previousBackgroundColor = '#1a1a1a';
let points = 0;
let answeredQuestions = [];
let enter = false


const Calculator = () => {

let username = localStorage.getItem("username")
const [questionIndex, setQuestionIndex] = useState(0);
const id = generateGameId();
let id = useLocation().state.gameId;

const navigator = useNavigate();

const [remTime, setRemTime] = useState(0);
const [totalTime, setTotalTime] = useState(0);

if(questions.length === 0)
generateQuestion();
Expand All @@ -31,9 +31,13 @@ const Calculator = () => {
const time = setInterval(() => {
setRemTime((progress) => {
if(progress === 100){
setTotalTime(totalTime + (80-progress/10)/questions.length)
gameStore(id, username, points, answeredQuestions, totalTime/answeredQuestions.length);
init();
console.log("Imprimimos id", id)
console.log("Answered questions", answeredQuestions)
let avgtime = 80/questions.length
if (!enter) {
gameStore(id, username, points, answeredQuestions, avgtime);
init();
}
navigator('/menu')
return 0;
}
Expand Down

0 comments on commit 109d0a6

Please sign in to comment.