diff --git a/src/main/java/com/hello/suripu/app/sensors/converters/SensorQueryParameters.java b/src/main/java/com/hello/suripu/app/sensors/converters/SensorQueryParameters.java index eb6ee116..410e3a16 100644 --- a/src/main/java/com/hello/suripu/app/sensors/converters/SensorQueryParameters.java +++ b/src/main/java/com/hello/suripu/app/sensors/converters/SensorQueryParameters.java @@ -9,7 +9,7 @@ public class SensorQueryParameters { private final DateTime end; private final Integer slotDuration; - public SensorQueryParameters(DateTime start, DateTime end, Integer slotDuration) { + public SensorQueryParameters(final DateTime start, final DateTime end, final Integer slotDuration) { this.start = start; this.end = end; this.slotDuration = slotDuration; @@ -28,14 +28,14 @@ public Integer slotDuration() { } public static SensorQueryParameters from(final QueryScope scope, final DateTime refUTC) { - + final DateTime end = refUTC.minusMinutes(3); // should trim the most recent minutes to avoid empty data switch(scope) { case DAY_5_MINUTE: - return new SensorQueryParameters(refUTC.minusHours(24), refUTC, 5); + return new SensorQueryParameters(refUTC.minusHours(24), end, 5); case LAST_3H_5_MINUTE: - return new SensorQueryParameters(refUTC.minusHours(3), refUTC, 5); + return new SensorQueryParameters(refUTC.minusHours(3), end, 5); case WEEK_1_HOUR: - return new SensorQueryParameters(refUTC.minusDays(7), refUTC, 60); + return new SensorQueryParameters(refUTC.minusDays(7), end, 60); default: throw new IllegalArgumentException("not supported"); }