Skip to content

Commit 71dea99

Browse files
committed
add nuanced impl when querying stopped transactions
apply time window to stop_timestamp column instead of start_timestamp (the case for active transactions)
1 parent f3110e1 commit 71dea99

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/java/de/rwth/idsg/steve/repository/impl/TransactionRepositoryImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,16 @@ private void processType(SelectQuery selectQuery, TransactionQueryForm form) {
327327
break;
328328

329329
case FROM_TO:
330-
selectQuery.addConditions(
331-
TRANSACTION.START_TIMESTAMP.between(form.getFrom().toDateTime(), form.getTo().toDateTime())
332-
);
330+
DateTime from = form.getFrom().toDateTime();
331+
DateTime to = form.getTo().toDateTime();
332+
333+
if (form.getType() == TransactionQueryForm.QueryType.ACTIVE) {
334+
selectQuery.addConditions(TRANSACTION.START_TIMESTAMP.between(from, to));
335+
336+
} else if (form.getType() == TransactionQueryForm.QueryType.STOPPED) {
337+
selectQuery.addConditions(TRANSACTION.STOP_TIMESTAMP.between(from, to));
338+
}
339+
333340
break;
334341

335342
default:

0 commit comments

Comments
 (0)