commit 66d1c8189c54d9a608b0b0cdacc110a1a0c59249 Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Apr 1 16:10:37 2020 +0200
Default date picker to latest available date.
Implements #30260. --- CHANGELOG.md | 3 +++ .../java/org/torproject/metrics/exonerator/ExoneraTorServlet.java | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md index f6cc649..923ab8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changes in version 4.?.? - 2020-0?-??
+ * Medium changes + - Default date picker to latest available date. + * Minor changes - Improve logging of the database importer. - Simplify logging configuration. diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java index 59535ea..2649546 100644 --- a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java +++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java @@ -16,6 +16,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.net.URL; import java.time.LocalDate; +import java.time.ZoneOffset; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -150,12 +151,15 @@ public class ExoneraTorServlet extends HttpServlet { ? (baseUrl + requestUri) : request.getRequestURL().toString();
/* Write form. */ + String defaultDateString = LocalDate.now(ZoneOffset.UTC) + .minusDays(2).toString(); boolean timestampOutOfRange = requestedDate.valid && (firstDate.valid && requestedDate.date.isBefore(firstDate.date) || (lastDate.valid && requestedDate.date.isAfter(lastDate.date))); this.writeForm(out, rb, relayIp, relayIpHasError || ("".equals(relayIp) && !requestedDate.empty), - requestedDate.asString, !relayIpHasError + requestedDate.valid ? requestedDate.asString : defaultDateString, + !relayIpHasError && !("".equals(relayIp) && !requestedDate.valid) && (!requestedDate.valid || timestampOutOfRange || (!"".equals(relayIp) && requestedDate.empty)), langStr);
tor-commits@lists.torproject.org