You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2020/06/14 14:52:30 UTC
[unomi] branch master updated: fix(SetEventOccurenceCountAction) -
fix future timestamp check
This is an automated email from the ASF dual-hosted git repository.
shuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/master by this push:
new 88ac76c fix(SetEventOccurenceCountAction) - fix future timestamp check
new 69becf3 Merge pull request #167 from YotpoLtd/ContextServletIT_fix
88ac76c is described below
commit 88ac76cb0393bd65832dd3411b6abd0b0ccc37b0
Author: nlevitsky <nl...@yotpo.com>
AuthorDate: Sun Jun 14 17:40:09 2020 +0300
fix(SetEventOccurenceCountAction) - fix future timestamp check
---
.../plugins/baseplugin/actions/SetEventOccurenceCountAction.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetEventOccurenceCountAction.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetEventOccurenceCountAction.java
index 3c4e6f2..d3e80b9 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetEventOccurenceCountAction.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/SetEventOccurenceCountAction.java
@@ -90,8 +90,8 @@ public class SetEventOccurenceCountAction implements ActionExecutor {
//Only increase the counter by 1 if the current event is in the now-numberOfDays range
LocalDateTime now = LocalDateTime.now(ZoneId.of("UTC"));
LocalDateTime eventTime = LocalDateTime.ofInstant(event.getTimeStamp().toInstant(),ZoneId.of("UTC"));
- long daysDiff = Duration.between(eventTime,now).toDays();
- if (daysDiff >= 0 && daysDiff <= numberOfDays) {
+ Duration durationDiff = Duration.between(eventTime,now);
+ if (!durationDiff.isNegative() && durationDiff.toDays() <= numberOfDays) {
count++;
}