diff --git a/gatewayservice/openapi.yaml b/gatewayservice/openapi.yaml index 620c1f2..abb945d 100644 --- a/gatewayservice/openapi.yaml +++ b/gatewayservice/openapi.yaml @@ -5,85 +5,12 @@ info: description: Gateway Service OpenAPI specification. servers: - - url: http://localhost:8000 - description: Development server - url: http://51.103.210.249:8000 description: Production server + - url: http://localhost:8000 + description: Development server paths: - - - /getUser: - get: - summary: Get a user from the database - tags: - - User - description: Retrieves a user from the database by their username. - parameters: - - in: query - name: username - schema: - type: string - required: true - description: The username of the user to retrieve. - responses: - '200': - description: User found successfully - content: - application/json: - schema: - type: object - properties: - username: - type: string - description: The username of the user. - password: - type: string - description: The hashed password of the user. - createdAt: - type: string - format: date-time - description: The date and time the user was created. - email: - type: string - description: The email address of the user. - questions_answered: - type: integer - description: The number of questions answered by the user. - correctly_answered_questions: - type: integer - description: The number of questions correctly answered by the user. - cheeseCount: - type: integer - description: The number of cheeses won in the trivial game. - example: - username: "exampleusername" - password: "hashed_password" - createdAt: "2024-04-24T12:00:00Z" - email: "example@example.com" - questions_answered: 20 - correctly_answered_questions: 18 - cheeseCount: 3 - '404': - description: User not found - content: - application/json: - schema: - type: object - properties: - error: - type: string - example: User not found - '500': - description: Internal Server Error - content: - application/json: - schema: - type: object - properties: - error: - type: string - example: Internal Server Error /getAllUsers: @@ -150,6 +77,83 @@ paths: type: string example: Internal Server Error + /getUser: + post: + summary: Get a user from the database + tags: + - User + description: Retrieves a user from the database by their username. + requestBody: + required: true + description: User credentials for retriving the corresponding data. + content: + application/json: + schema: + type: object + properties: + username: + type: string + description: The username of the user. + required: + - username + responses: + '200': + description: User found successfully + content: + application/json: + schema: + type: object + properties: + username: + type: string + description: The username of the user. + password: + type: string + description: The hashed password of the user. + createdAt: + type: string + format: date-time + description: The date and time the user was created. + email: + type: string + description: The email address of the user. + questions_answered: + type: integer + description: The number of questions answered by the user. + correctly_answered_questions: + type: integer + description: The number of questions correctly answered by the user. + cheeseCount: + type: integer + description: The number of cheeses won in the trivial game. + example: + username: "exampleusername" + password: "hashed_password" + createdAt: "2024-04-24T12:00:00Z" + email: "example@example.com" + questions_answered: 20 + correctly_answered_questions: 18 + cheeseCount: 3 + '404': + description: User not found + content: + application/json: + schema: + type: object + properties: + error: + type: string + example: User not found + '500': + description: Internal Server Error + content: + application/json: + schema: + type: object + properties: + error: + type: string + example: Internal Server Error diff --git a/webapp/e2e/steps/statistics.steps.js b/webapp/e2e/steps/statistics.steps.js index eaf080d..6541588 100644 --- a/webapp/e2e/steps/statistics.steps.js +++ b/webapp/e2e/steps/statistics.steps.js @@ -15,7 +15,7 @@ defineFeature(feature, test => { : await puppeteer.launch({ headless: false, slowMo: 40 }); page = await browser.newPage(); //Way of setting up the timeout - setDefaultOptions({ timeout: 10000 }) + setDefaultOptions({ timeout: 20000 }) await page .goto("http://localhost:3000", { diff --git a/webapp/src/components/stats/StatsTable.tsx b/webapp/src/components/stats/StatsTable.tsx index c70eff1..3da8411 100644 --- a/webapp/src/components/stats/StatsTable.tsx +++ b/webapp/src/components/stats/StatsTable.tsx @@ -33,31 +33,31 @@ export default function StatsTable() { - - + + - - - + + + - - - + + + - - - + + + - - + +
StatisticsValueStatisticsValue
Correct Answers{questionsCorrect}
Correct Answers{questionsCorrect}
Wrong Answers{questionsAnswered - questionsCorrect}
Wrong Answers{questionsAnswered - questionsCorrect}
Gained chesses{chesses}
Gained chesses{chesses}
Percentage Correct
Percentage Correct 0 ? (Math.round(((questionsCorrect / questionsAnswered) * 100) * 100) / 100) : 0} - color='#00A078' thickness='.3rem' - size={"3rem"}> - + color='#00A078' thickness='.4rem' + size={"4rem"}> + {questionsAnswered > 0 ? (Math.round(((questionsCorrect / questionsAnswered) * 100) * 100) / 100).toFixed(0) : 0}%