You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "Kevan Jahanshahi (Jira)" <ji...@apache.org> on 2021/07/01 15:54:00 UTC

[jira] [Commented] (UNOMI-482) SetPropertyAction eventArrivalTime

    [ https://issues.apache.org/jira/browse/UNOMI-482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17372906#comment-17372906 ] 

Kevan Jahanshahi commented on UNOMI-482:
----------------------------------------

Hello.

I quit do not like the current implem of the "now" option of the setPropertyAction, there is dedicated logic that have been introduce to fix the lastVisit and firstVisit property of the profiles for ticket: https://issues.apache.org/jira/browse/UNOMI-338

The issue was also related to event.timeStamp, I dont understand why there is dedicated logic related to lastVisit and firstVisit in this generic action. This action is generic and should not contains specific code directly related to specific profile properties. For me the fix for https://issues.apache.org/jira/browse/UNOMI-338 is not correct, it should have been done differently.

The "now" option is now unusable by anything else than "profile.lastVisit" because of this fix, here is the explaination why with some sample cases that show the level of craziness of this "now" option.

{color:#FF0000}In the case above you will see *"realNow"*, this actually the timeStamp when the action is being executed. So basically "*realNow*" always equals to "new Date()".{color}
h2. CASE 1: profile.firstVisit > event.timeStamp then the "now" = realNow (new Date())

Profile.firstVisit = 12/01/2021 11h00
event.timeStamp = 12/01/2021 10h00
realNow = 12/01/2021 11h30
setPropertyAction: myProp = now
result: myProp = 12/01/2021 11h30 (realNow is used)
h2. CASE 2: profile.firstVisit < event.timeStamp then the "now" = event.timeStamp

Profile.firstVisit = 12/01/2021 9h00
event.timeStamp = 12/01/2021 10h00
realNow = 12/01/2021 10h30
setPropertyAction: myProp = now

result: myProp = 12/01/2021 10h00 (event time stamp is used)
h2. CASE 3: (profile.firstVisit == null and event.timeStamp < realNow) then the "now" = realNow (new Date())

Profile.firstVisit = null
event.timeStamp = 12/01/2021 10h00
realNow = 12/01/2021 10h30
setPropertyAction: myProp = now

result: myProp = 12/01/2021 10h00 (realNow is used)
h2. CASE 4: (profile.firstVisit == null and event.timeStamp > realNow) then the "now" = event.timeStamp

Profile.firstVisit = null
event.timeStamp = 12/01/2021 10h30
realNow = 12/01/2021 10h00
setPropertyAction: myProp = now

result: myProp = 12/01/2021 10h30 (event time stamp is used)

 

As you can see the "now" option is barely understandable and it doesnt behave the same depending on the "firstVisit" property, and this is not a normal thing for a generic option that could be used by any rules, any actions in the system for stuff that is originally unrelated to "firstVisit" profile property value.

Appart from that, this made the "now" option unusable by something else than "lastVisit" property.

So I do understand your need to have something more stable to get the realNow as a property value.

And I put a comment in the PR, but it's just for naming purpose.

> SetPropertyAction eventArrivalTime
> ----------------------------------
>
>                 Key: UNOMI-482
>                 URL: https://issues.apache.org/jira/browse/UNOMI-482
>             Project: Apache Unomi
>          Issue Type: New Feature
>            Reporter: Amit Cohen
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> In setPropertyAction, "now" in propertyValue is being translated to event.timeStamp.
> I would like to add support for "eventArrivalTime" which will be the current time in which the event got into Unomi.
> an example to emphasize the need - 
> event1 arrived with timestamp - 8:00
> then, event2 arrived with timestamp - 7:00
> the profile will be updated with lastUpdatedTime - 7:00, which is not true
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)