Skip to content

Commit

Permalink
Merge pull request #283 from Arquisoft/fix/codeSmells
Browse files Browse the repository at this point in the history
Fix: Eliminated unnecessary code
  • Loading branch information
Toto-hitori authored Apr 24, 2024
2 parents 994b232 + 2d222ad commit 89f7626
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,11 @@
@Component
public class QuestionHelper {

private static int MAX_DISTRACTORS = 3;
private QuestionHelper(){} // To hide the implicit public constructor as this is static only

public static List<Answer> getDistractors(AnswerRepository answerRepository, Question question){
List<Answer> distractors = new ArrayList<>();
AnswerCategory cat = question.getAnswerCategory();

switch (cat){ // Write the case only for the exceptions
case COUNTRY:
// Implement more cases
break;
default:
distractors = answerRepository.findDistractors(question.getAnswerCategory().toString(), question.getLanguage(), question.getCorrectAnswer().getText(), MAX_DISTRACTORS);
}
private static final int MAX_DISTRACTORS = 3;

return distractors;
public static List<Answer> getDistractors(AnswerRepository answerRepository, Question question){
return answerRepository.findDistractors(question.getAnswerCategory().toString(), question.getLanguage(), question.getCorrectAnswer().getText(), MAX_DISTRACTORS);
}
}

0 comments on commit 89f7626

Please sign in to comment.