From bb34eff8d1670d459e051d437481bc215e4a9714 Mon Sep 17 00:00:00 2001 From: Mister-Mario Date: Sun, 7 Apr 2024 23:05:26 +0200 Subject: [PATCH] Solving merge problems --- questionGenerator/src/main/java/Main.java | 27 ++++++++++++------- .../HistoricalData/HistoricalView.test.js | 4 +-- .../HistoricalData/HistoryRecordRetriever.js | 4 ++- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/questionGenerator/src/main/java/Main.java b/questionGenerator/src/main/java/Main.java index f90f830e..cb196b9e 100644 --- a/questionGenerator/src/main/java/Main.java +++ b/questionGenerator/src/main/java/Main.java @@ -10,26 +10,35 @@ public class Main { public static void main(String[] args) { - QuestionGenerator qg = new QuestionGenerator("en"); + QuestionGenerator qgEn = new QuestionGenerator("en"); - run(qg, QuestionType.CAPITAL, 3); + run(qgEn, QuestionType.CAPITAL, 3); System.out.println(); - run(qg, QuestionType.LANGUAGE, 3); + run(qgEn, QuestionType.LANGUAGE, 3); System.out.println(); - run(qg, QuestionType.POPULATION, 3); + run(qgEn, QuestionType.POPULATION, 3); System.out.println(); - run(qg, QuestionType.SIZE, 3); + run(qgEn, QuestionType.SIZE, 3); + + QuestionGenerator qgEs = new QuestionGenerator("es"); + + run(qgEs, QuestionType.CAPITAL, 3); + System.out.println(); + + run(qgEs, QuestionType.LANGUAGE, 3); + System.out.println(); + + run(qgEs, QuestionType.POPULATION, 3); + System.out.println(); + + run(qgEs, QuestionType.SIZE, 3); } private static void run(QuestionGenerator qg, QuestionType type, int numberOfQuestions){ List questions = qg.generateQuestions(type, numberOfQuestions); - for(int i=0; i q.getJSON().toString()).toList()); } } diff --git a/webapp/src/components/HistoricalData/HistoricalView.test.js b/webapp/src/components/HistoricalData/HistoricalView.test.js index 43cf59bb..e224a4ce 100644 --- a/webapp/src/components/HistoricalData/HistoricalView.test.js +++ b/webapp/src/components/HistoricalData/HistoricalView.test.js @@ -40,7 +40,7 @@ describe('Historical View component', () => { it('renders Game Record Buttons', async () => { const user = { username: 'dummy' }; mockAxios.onGet('http://localhost:8000/record/dummy').reply(200, - [{user: "dummy", + {record : {user: "dummy", games: [{ questions: [{ question: "What is the capital of Spain?", @@ -50,7 +50,7 @@ describe('Historical View component', () => { }], points: "200", date: "1712344268728" - }]}]); + }]}}); await act(async()=> await render() diff --git a/webapp/src/components/HistoricalData/HistoryRecordRetriever.js b/webapp/src/components/HistoricalData/HistoryRecordRetriever.js index 5b574310..d586a867 100644 --- a/webapp/src/components/HistoricalData/HistoryRecordRetriever.js +++ b/webapp/src/components/HistoricalData/HistoryRecordRetriever.js @@ -11,7 +11,9 @@ class HistoryRecordRetriever{ try { const response = await axios.get(this.apiUrl + '/' + user); const receivedRecords = await response.data; - return receivedRecords[0]; + console.log(receivedRecords) + console.log(receivedRecords[0]) + return receivedRecords.record; } catch (error) { console.log(error) throw new Error(error);