Skip to content

Commit

Permalink
Little fixes for last release
Browse files Browse the repository at this point in the history
Last Release
  • Loading branch information
UO289930 authored May 1, 2024
2 parents c3785b1 + 5d08fdc commit 02938f8
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 92 deletions.
154 changes: 79 additions & 75 deletions gatewayservice/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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



Expand Down
2 changes: 1 addition & 1 deletion webapp/e2e/steps/statistics.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
32 changes: 16 additions & 16 deletions webapp/src/components/stats/StatsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@ export default function StatsTable() {
<table className="stats-table text-text text-4xl " data-testid="stats-table">
<thead>
<tr className="header">
<th className="statistics" style={{ padding: '5px' , fontSize:'1.5em' }}>Statistics</th>
<th className="value" style={{ padding: '5px', fontSize:'1.5em'}}>Value</th>
<th className="self-center text-4xl p-5" >Statistics</th>
<th className="self-center text-4xl p-5" >Value</th>
</tr>
</thead>
<tbody>
<tr className="body-row">
<td className="row-header" style={{ padding: '5px' }}>Correct Answers</td>
<td data-testid="correct-answers" style={{ padding: '5px' }}>{questionsCorrect}</td>
<tr className="body-row transition-transform duration-100 transform hover:text-green-500">
<td className="self-center text-2xl p-5">Correct Answers</td>
<td className="text-2xl p-5" data-testid="correct-answers">{questionsCorrect}</td>
</tr>
<tr className="body-row">
<td className="row-header" style={{ padding: '5px' }}>Wrong Answers</td>
<td data-testid="wrong-answers" style={{ padding: '5px' }}>{questionsAnswered - questionsCorrect}</td>
<tr className="body-row transition-transform duration-100 transform hover:text-green-500">
<td className="self-center text-2xl p-5 " >Wrong Answers</td>
<td className="text-2xl p-5 " data-testid="wrong-answers">{questionsAnswered - questionsCorrect}</td>
</tr>
<tr className="body-row">
<td className="row-header" style={{ padding: '5px' }}>Gained chesses</td>
<td data-testid="chesses-gained" style={{ padding: '5px' }}>{chesses}</td>
<tr className="body-row transition-transform duration-100 transform hover:text-green-500">
<td className="self-center text-2xl p-5">Gained chesses</td>
<td className="text-2xl p-5" data-testid="chesses-gained">{chesses}</td>
</tr>
<tr className="body-row">
<td className="row-header" style={{ padding: '5px' }}>Percentage Correct</td>
<tr className="body-row transition-transform duration-100 transform hover:text-green-500">
<td className="self-center text-2xl p-5 ">Percentage Correct</td>
<td style={{ padding: '5px' }}>
<CircularProgress
value={ questionsAnswered > 0 ? (Math.round(((questionsCorrect / questionsAnswered) * 100) * 100) / 100) : 0}
color='#00A078' thickness='.3rem'
size={"3rem"}>
<CircularProgressLabel >
color='#00A078' thickness='.4rem'
size={"4rem"}>
<CircularProgressLabel fontSize={20}>
{questionsAnswered > 0 ? (Math.round(((questionsCorrect / questionsAnswered) * 100) * 100) / 100).toFixed(0) : 0}%
</CircularProgressLabel>
</CircularProgress>
Expand Down

0 comments on commit 02938f8

Please sign in to comment.