Skip to content

Commit

Permalink
Fix filtering of history by time
Browse files Browse the repository at this point in the history
Closes #913
  • Loading branch information
theotherp committed Jan 10, 2024
1 parent c2f99f5 commit bd08bda
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
7 changes: 3 additions & 4 deletions core/src/main/java/org/nzbhydra/historystats/History.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ public <T> Page<T> getHistory(HistoryRequest requestData, String tableName, Clas
} else if (filterType.equals("time")) {
Map<String, String> beforeAndAfter = (Map<String, String>) columnAndFilterDefinition.getValue().getFilterValue();
if (beforeAndAfter.get("before") != null) {
wheres.add(String.format("%s <= :%s", columnName, columnName));
parameters.put(columnName, filterValue);
//yyyy-MM-dd'T'HH:mm:ssZ
wheres.add(String.format("%s <= PARSEDATETIME('%s', 'yyyy-MM-ddHH:mm:ss.SSS')", columnName, beforeAndAfter.get("before").replace("T", "").replace("Z", "")));
}
if (beforeAndAfter.get("after") != null) {
wheres.add(String.format("%s >= :%s", columnName, columnName));
parameters.put(columnName, filterValue);
wheres.add(String.format("%s >= PARSEDATETIME('%s', 'yyyy-MM-ddHH:mm:ss.SSS')", columnName, beforeAndAfter.get("after").replace("T", "").replace("Z", "")));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{
"name":"org.nzbhydra.searching.IndexerForSearchSelector$$SpringCGLIB$$0",
"customTargetConstructorClass":"java.lang.Object"
},
{
"name": "java.util.LinkedHashMap"
}
],
"lambdaCapturingTypes":[
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/resources/changelog.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#@formatter:off
- version: "v5.3.7"
changes:
- type: "fix"
text: "Fix filtering of history by time. See #913"
final: true
- version: "v5.3.6"
changes:
- type: "fix"
Expand Down
4 changes: 2 additions & 2 deletions core/ui-src/html/dataTable/columnFilterTime.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<span>
<p class="input-group" style="margin-left: 5px; margin-right: 5px;">
<span class="input-group-addon" id="basic-addon3" style="min-width: 70px">After</span>
<input type="text" class="form-control" uib-datepicker-popup ng-model="selected.afterDate"
<input type="text" class="form-control" uib-datepicker-popup ng-model="selected.afterDate" close-on-date-selection="false"
is-open="after.opened" datepicker-options="dateOptions" close-text="Close"
style="min-width: 110px"/>
<span class="input-group-btn input-group-btn2">
Expand All @@ -13,7 +13,7 @@

<p class="input-group" style="margin-left: 5px; margin-right: 5px;">
<span class="input-group-addon" id="basic-addon3" style="min-width: 70px">Before</span>
<input type="text" class="form-control" uib-datepicker-popup ng-model="selected.beforeDate"
<input type="text" class="form-control" uib-datepicker-popup ng-model="selected.beforeDate" close-on-date-selection="false"
is-open="before.opened" datepicker-options="dateOptions" close-text="Close"
style="min-width: 110px"/>
<span class="input-group-btn input-group-btn2">
Expand Down

0 comments on commit bd08bda

Please sign in to comment.