Skip to content

Commit

Permalink
Feat: Properly render image questions
Browse files Browse the repository at this point in the history
  • Loading branch information
UO283615 committed Apr 21, 2024
1 parent 45517e1 commit 3208c21
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public QuestionResponseDto apply(Question question) {
if(question.getType().equals(QuestionType.IMAGE))
return QuestionResponseDto.builder()
.id(question.getId())
.content(question.getContent().split("#\\* &%")[0])
.content(question.getContent().split("%& #")[0])
.type(question.getType())
.answerCategory(question.getAnswerCategory())
.answers(question.getAnswers().stream().map(new AnswerResponseDtoMapper()).toList())
.language(question.getLanguage())
.questionCategory(question.getQuestionCategory())
.image(question.getContent().split("#\\* &%")[1])
.image(question.getContent().split("%& #")[1])
.build();

return QuestionResponseDto.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void setQuery() {
" OPTIONAL {\n" +
" ?game wdt:P495 ?countryItem. " +
" ?countryItem rdfs:label ?countryLabel. " +
" FILTER(LANG(?countryLabel) IN (\"en\", \"es\")) " +
" FILTER(LANG(?countryLabel) IN (\"" + langCode + "\")) " +
" } " +
" SERVICE wikibase:label { bd:serviceParam wikibase:language \"" + langCode + "\". } " +
"} " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public void processResults() {

if (langCode.equals("es")){
spanishString = spanishStrings[i%4] + QGHelper.LINKCONCAT + "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/" + pokedexNum + ".png";
questions.add(new Question(a, spanishString, QuestionCategory.VIDEOGAMES, QuestionType.TEXT));
questions.add(new Question(a, spanishString, QuestionCategory.VIDEOGAMES, QuestionType.IMAGE));
}
else{
englishString = englishStrings[i%4] + QGHelper.LINKCONCAT + "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/" + pokedexNum + ".png";
questions.add(new Question(a, englishString, QuestionCategory.VIDEOGAMES, QuestionType.TEXT));
questions.add(new Question(a, englishString, QuestionCategory.VIDEOGAMES, QuestionType.IMAGE));
}
}

Expand Down

0 comments on commit 3208c21

Please sign in to comment.