diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java index 4916e3ce..ddab83a6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java @@ -100,8 +100,7 @@ public class ClientConnectionData { while (i1.hasNext()) { final IndicatorValue iv1 = i1.next(); final IndicatorValue iv2 = i2.next(); - if (iv1.getIndicatorId().longValue() != iv2.getIndicatorId().longValue() || - Math.abs(iv1.getValue() - iv2.getValue()) > 0.1) { + if (!iv1.dataEquals(iv2)) { return false; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/IndicatorValue.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/IndicatorValue.java index 8f418d09..ef817f5e 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/IndicatorValue.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/IndicatorValue.java @@ -38,4 +38,15 @@ public interface IndicatorValue extends IndicatorValueHolder { } } + default boolean dataEquals(final IndicatorValue other) { + final Long i1 = getIndicatorId(); + final Long i2 = other.getIndicatorId(); + if (i1 != null && i2 != null) { + if (i1.longValue() != i2.longValue() || Math.abs(this.getValue() - other.getValue()) > 0.1) { + return false; + } + } + return true; + } + } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java index ade18eba..5be1a549 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java @@ -98,7 +98,7 @@ public class ClientIndicatorFactory { .getBean(PingIntervalClientIndicator.class); pingIndicator.setHidden(); final Indicator indicator = new Indicator( - null, + -1L, clientConnection.examId, "hidden_ping_indicator", IndicatorType.LAST_PING, diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractLogNumberIndicator.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractLogNumberIndicator.java index 8695a6f4..a12f48f7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractLogNumberIndicator.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractLogNumberIndicator.java @@ -54,9 +54,6 @@ public abstract class AbstractLogNumberIndicator extends AbstractLogIndicator { } private void valueChanged(final String text, final double value) { - - this.currentValue = getValue() + 1d; - if (this.tags == null || this.tags.length == 0 || hasTag(text)) { if (super.ditributedIndicatorValueRecordId != null) { if (!this.distributedPingCache.updateIndicatorValueAsync(