Skip to content

Commit

Permalink
Solving merge problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Mario committed Apr 7, 2024
1 parent 1af13d5 commit bb34eff
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
27 changes: 18 additions & 9 deletions questionGenerator/src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Question> questions = qg.generateQuestions(type, numberOfQuestions);
for(int i=0; i<questions.size(); i++) {
Question question = questions.get(i);
System.out.println(question.getJSON().toString());
}
QuestionRepository.getInstance().insert(questions.stream().map(q -> q.getJSON().toString()).toList());
}
}
4 changes: 2 additions & 2 deletions webapp/src/components/HistoricalData/HistoricalView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?",
Expand All @@ -50,7 +50,7 @@ describe('Historical View component', () => {
}],
points: "200",
date: "1712344268728"
}]}]);
}]}});

await act(async()=>
await render(<UserContextProvider baseUser={user}><MemoryRouter><HistoricalView /></MemoryRouter></UserContextProvider>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bb34eff

Please sign in to comment.