|
|
@@ -1280,16 +1280,16 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
String whereTimestampClause;
|
|
|
Tuple tupleParams;
|
|
|
if (from != null && to != null) {
|
|
|
- whereTimestampClause = "tel.time_stamp >= (CASE WHEN $4 < c.from_time THEN c.from_time ELSE $4 END) AND tel.time_stamp <= (CASE WHEN $5 > c.to_time THEN c.to_time ELSE $5 END)";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= (CASE WHEN $4 < c.from_time THEN c.from_time ELSE $4 END) AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN $5 ELSE (CASE WHEN $5 > c.to_time THEN c.to_time ELSE $5 END) END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit, from, to);
|
|
|
} else if (from != null) {
|
|
|
- whereTimestampClause = "tel.time_stamp >= (CASE WHEN $4 < c.from_time THEN c.from_time ELSE $4 END) AND tel.time_stamp <= c.to_time";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= (CASE WHEN $4 < c.from_time THEN c.from_time ELSE $4 END) AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN now() ELSE c.to_time END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit, from);
|
|
|
} else if (to != null) {
|
|
|
- whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= (CASE WHEN $4 > c.to_time THEN c.to_time ELSE $4 END)";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN $4 ELSE (CASE WHEN $4 > c.to_time THEN c.to_time ELSE $4 END) END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit, to);
|
|
|
} else {
|
|
|
- whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= c.to_time";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN now() ELSE c.to_time END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit);
|
|
|
}
|
|
|
|
|
|
@@ -1360,16 +1360,16 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
String whereTimestampClause;
|
|
|
Tuple tupleParams;
|
|
|
if (from != null && to != null) {
|
|
|
- whereTimestampClause = "tel.time_stamp >= (CASE WHEN $5 < c.from_time THEN c.from_time ELSE $5 END) AND tel.time_stamp <= (CASE WHEN $6 > c.to_time THEN c.to_time ELSE $6 END)";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= (CASE WHEN $5 < c.from_time THEN c.from_time ELSE $5 END) AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN $6 ELSE (CASE WHEN $6 > c.to_time THEN c.to_time ELSE $6 END) END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit, userIdentity, from, to);
|
|
|
} else if (from != null) {
|
|
|
- whereTimestampClause = "tel.time_stamp >= (CASE WHEN $5 < c.from_time THEN c.from_time ELSE $5 END) AND tel.time_stamp <= c.to_time";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= (CASE WHEN $5 < c.from_time THEN c.from_time ELSE $5 END) AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN now() ELSE c.to_time END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit, userIdentity, from);
|
|
|
} else if (to != null) {
|
|
|
- whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= (CASE WHEN $5 > c.to_time THEN c.to_time ELSE $5 END)";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN $5 ELSE (CASE WHEN $5 > c.to_time THEN c.to_time ELSE $5 END) END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit, userIdentity, to);
|
|
|
} else {
|
|
|
- whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= c.to_time";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= c.from_time AND tel.time_stamp <= (CASE WHEN c.to_time IS NULL THEN now() ELSE c.to_time END)";
|
|
|
tupleParams = Tuple.of(campaignId, offset, limit, userIdentity);
|
|
|
}
|
|
|
|