From 158f3fd2fdaad870060919cadaae50aaadc85a29 Mon Sep 17 00:00:00 2001
From: Christoph Thelen <christoph.thelen@mni.thm.de>
Date: Wed, 11 Feb 2015 20:36:50 +0100
Subject: [PATCH] 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.
---
 src/main/java/de/thm/arsnova/domain/CourseScore.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/de/thm/arsnova/domain/CourseScore.java b/src/main/java/de/thm/arsnova/domain/CourseScore.java
index 54008a2d..fa3c9d92 100644
--- a/src/main/java/de/thm/arsnova/domain/CourseScore.java
+++ b/src/main/java/de/thm/arsnova/domain/CourseScore.java
@@ -41,7 +41,9 @@ public class CourseScore implements Iterable<QuestionScore> {
 	 */
 	public void add(String questionId, String username, int userscore) {
 		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.add(username, userscore);
-- 
GitLab