Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaderboard and questions fix #196

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions webapp/src/components/leaderboard/RankingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function RankingTable() {
<th className="avatar"></th>
<th className="ranking">RANKING</th>
<th className="correct-answers">CORRECT ANSWERS</th>
<th className="progress"></th>
<th className="progress">% CORRECT ANSWERS</th>
</tr>
</thead>
<tbody>
Expand All @@ -69,10 +69,10 @@ export default function RankingTable() {
<td className="correct-answers">{user.correctAnswers}</td>
<td className="progress">
<CircularProgress
value={user.totalAnswers - (user.totalAnswers - user.correctAnswers)}
value={ user.totalAnswers > 0 ? (Math.round(((user.correctAnswers / user.totalAnswers) * 100) * 100) / 100) : 0}
color='#00A078' thickness='.4rem'
size={"3.6rem"}>
<CircularProgressLabel>{user.totalAnswers - (user.totalAnswers - user.correctAnswers)}%</CircularProgressLabel>
<CircularProgressLabel>{user.totalAnswers > 0 ? (Math.round(((user.correctAnswers / user.totalAnswers) * 100) * 100) / 100).toFixed(0) : 0}%</CircularProgressLabel>
</CircularProgress>
</td>
</tr>
Expand Down
10 changes: 5 additions & 5 deletions wikidataservice/src/Models/Question-Model.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"topic":"Geography"
},
{
"question": "Which is the highest point of: ",
"question": "Which is the highest point in: ",
"themeId": "Q6256",
"attributeId": "P610",
"topic":"Geography"
},
{
"question": "Who is the actual trainer of: ",
"question": "Who is the actual coach of: ",
"themeId": "Q476028",
"attributeId": "P286",
"topic":"Sport"
Expand All @@ -50,7 +50,7 @@
"topic":"Entertainment"
},
{
"question": "Who did the song: ",
"question": "Who wrote the song: ",
"themeId": "Q7366",
"attributeId": "P86",
"topic":"Entertainment"
Expand All @@ -62,13 +62,13 @@
"topic":"Entertainment"
},
{
"question": "What is the element of: ",
"question": "What is the chemical element for: ",
"themeId": "Q11344",
"attributeId": "P246",
"topic":"Chemistry"
},
{
"question": "Who is the chemical formula of: ",
"question": "Who is the chemical formula for: ",
"themeId": "Q11173",
"attributeId": "P274",
"topic":"Chemistry"
Expand Down
4 changes: 2 additions & 2 deletions wikidataservice/src/Services/QueryGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class QueryGenerator {
for (let item of items) {
if (item.hasOwnProperty('year')) {
// If the item has a year property, generate a query with the date parsed
query = this.generateSparqlQueryYear(item.themeId, item.attributeId, 5);
query = this.generateSparqlQueryYear(item.themeId, item.attributeId, 200);
} else {
query = this.generateSparqlQuery(item.themeId, item.attributeId, 5);
query = this.generateSparqlQuery(item.themeId, item.attributeId, 200);
}

let obj = {
Expand Down
2 changes: 1 addition & 1 deletion wikidataservice/src/Services/QuestionGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function generateQuestions(questionMessage, dataSet, numberQuestions = 10){
const wrongIds = new Set();
for (let w = 1; w < 4; w++) {
let wrongId = Math.floor(Math.random()*dataSet.length);
while (idsList[j] === wrongId || wrongIds.has(wrongId)) {
while (idsList[j] === wrongId || wrongIds.has(wrongId) || answers.includes(dataSet[wrongId].attributeLabel.value)) {
wrongId = Math.floor(Math.random()*dataSet.length);
}
// Add the id of the incorrect answer to the set
Expand Down
Loading