How to set a timer?

Created on 1 March 2023, almost 2 years ago
Updated 13 July 2023, over 1 year ago

Hello,

is there any possibility to set a timer if event triggered for user to retrigger?

I have a ECA like this:

User log in --> Set user token --> switch User --> Create transaction --> Set required fields --> Save.

How i can now check, if that event already triggered in 24 hours for recent logged in user or not?

Thanks in advance.

💬 Support request
Status

Fixed

Version

1.1

Component

User interface

Created by

🇩🇪Germany KiLLAH89

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @KiLLAH89
  • 🇩🇪Germany jurgenhaas Gottmadingen

    This can be done in two alternative ways:

    With a combination of Cron and Views you can regularly run a model and receive the list of users where your criteria matches and then loop through those users and do whatever is necessary. Samples of that can be found in the library of the ECA Guide.

    As an alternative, you could use the Drupal queue and add a task for later execution to that queue. For that you can use the Enqueue a task with a delay action.

  • 🇩🇪Germany KiLLAH89

    Thank you for the fast reply.

    I looked through the library of the ECA Guide, but can't find any similar guide to start with. Can you or someone else go deeper in details for better insight?

    Let's say User A log into website and got credited with some points for their daily login. Now, when User A log out and log in again, they should not get points for at least 24 hours where the last transaction for daily login triggered.

    An ECA Model is already created and working to create the transaction, but triggers everytime User A log in.

    Thanks for any suggestions.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Let's say User A log into website and got credited with some points for their daily login. Now, when User A log out and log in again, they should not get points for at least 24 hours where the last transaction for daily login triggered.

    Assuming that you're storing the timestamp of the last credit somewhere, you would just use that timestamp and compare it to the current time. In your model, you would then include a condition that only continues if the difference between the two value is greater than 24 hours.

    This is much simpler than what I originally proposed, as it is not something that should happen without user interaction, it is triggered by the next login, so that's so much easier then.

  • 🇩🇪Germany KiLLAH89

    I tried your suggestion, but it seems there's no option to compare 2 fields between a specific value/date/time or something else.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    no operator for "between"

    What do you mean by that? From your description I thought you wanted to avoid another credit with 24 hours. In that case you only need to check if the difference is greater than 24 hours.

    However, if you wanted to check, if a value is between two other values, then you use a first condition to check if the value is greater than the lower value and then a second condition to check if it's lower than the upper value.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    BTW, the library contains an example on how to combine conditions: https://ecaguide.org/library/simple/combined_conditions

  • Status changed to Postponed: needs info over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    @KiLLAH89 have you had a chance to resolve this or is there anything outstanding that we can help to resolve?

  • Status changed to Fixed over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Closing due to missing feedback.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024