From f2d5a6d4c61002e992c884420f515293d7ed834e Mon Sep 17 00:00:00 2001
From: Daniel Gerhardt <code@dgerhardt.net>
Date: Sat, 6 Feb 2016 14:56:42 +0100
Subject: [PATCH] Do not test double against 0

---
 src/main/java/de/thm/arsnova/services/FeedbackService.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/de/thm/arsnova/services/FeedbackService.java b/src/main/java/de/thm/arsnova/services/FeedbackService.java
index 2eef17fbc..bea28496d 100644
--- a/src/main/java/de/thm/arsnova/services/FeedbackService.java
+++ b/src/main/java/de/thm/arsnova/services/FeedbackService.java
@@ -47,6 +47,7 @@ import java.util.Set;
 public class FeedbackService implements IFeedbackService, ApplicationEventPublisherAware {
 
 	private static final int DEFAULT_SCHEDULER_DELAY = 5000;
+	private static final double Z_THRESHOLD = 0.1;
 
 	/**
 	 * minutes, after which the feedback is deleted
@@ -152,7 +153,7 @@ public class FeedbackService implements IFeedbackService, ApplicationEventPublis
 		final double sum = values.get(Feedback.FEEDBACK_OK) + values.get(Feedback.FEEDBACK_SLOWER) * 2
 				+ values.get(Feedback.FEEDBACK_AWAY) * 3;
 
-		if (count == 0) {
+		if (Math.abs(count) < Z_THRESHOLD) {
 			throw new NoContentException();
 		}
 		return sum / count;
-- 
GitLab