Skip to content
Snippets Groups Projects
Commit 158f3fd2 authored by Christoph Thelen's avatar Christoph Thelen
Browse files

Ignore questions that weren't added previously

There might be answers to questions without values,
those would have hit the exception. So it is better
to just ignore those questions.
parent 85059f96
No related merge requests found
...@@ -41,7 +41,9 @@ public class CourseScore implements Iterable<QuestionScore> { ...@@ -41,7 +41,9 @@ public class CourseScore implements Iterable<QuestionScore> {
*/ */
public void add(String questionId, String username, int userscore) { public void add(String questionId, String username, int userscore) {
if (!scores.containsKey(questionId)) { if (!scores.containsKey(questionId)) {
throw new IllegalArgumentException("Invalid argument questionId"); // Precondition failed, ignore this element.
// Most likely this is a question that has no learning progress value.
return;
} }
QuestionScore questionScore = scores.get(questionId); QuestionScore questionScore = scores.get(questionId);
questionScore.add(username, userscore); questionScore.add(username, userscore);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment