Metadecidim
Sign in

Process

Co-creating the roadmap 2025–2027

finished not yet on protocol

Possibility to automatically activate process steps

This issue originates from a GitHub issue 2 years back. In that issue you will find the proposed technical details which are left out from this. The issue has been modified with updated context information.


**Is your feature request related to a problem? Please describe.**

Many people don't want to wake up at midnight to manually change the step when the process phase ends. This could be avoided if the step changes could be scheduled.

**Describe the solution you'd like**

It should be possible to make schedule the steps to be activated automatically.

In the process step settings, the user could control with a checkbox if the step should be automatically scheduled to be activated at a given time. The activation time should be another configuration option that is apart from the step start and end dates. In the activation time, the user should also configure the time of the day when the activation happens with the timezone set for the Decidim instance.

The automated activation should be optional per step.

**Describe alternatives you've considered**

Custom cronjobs that run an SQL query at the given time but this would have to be configured each and every time specifically to the case. Does not sound very appealing or cost efficient.

**Additional context**

There can be conflict situations if multiple steps of the same process have been configured to be activated at different times. The last step in order should always "win" if multiple steps are configured to be activated at the exact same time.

In the original GitHub issue the suggested technical solution was ActiveJob+whenever. This should be designed so that it would be configurable on all platforms. It was mentioned that e.g. Heroku does not provide cron and therefore whenever would not work there.

**Does this issue could impact on users private data?**

No.

**Funded by**

Currently no one has provided the funds to implement this but everyone constantly requests this feature.

6 comments

  1. Hey @ah

    We've proposed something similar

    Plan and automate step change at a precise hour

    We agree with your implementation and @Armand-OSP suggested to use a "scheduler" to do this.

    We were also proposing to add a precise time to the activation date so that you can precisely plan the activation of the step.

    @product do you agree with the feature ?

    0 votes up 0 votes down
    1. OSP: I tried to tag you below but I get an HTTP 422 error when I put the (at) character next to your name. See below.

      I would very much welcome this feature to Decidim but it may not be as trivial to find a scheduler that suits all Decidim needs.

      In the GitHub thread oriolgual suggested that Sidekiq should be enforced to use sidekiq-cron or sidekiq-scheduler for this but I would not suggest that since I believe Sidekiq requires Decidim to be 100% thread safe. Has anyone tested thread safety of Decidim? I would bet a wild bet it's not 100% thread safe.

      0 votes up 0 votes down
  2. The implementation of this feature should be rather trivial:
    - Add a field to the ParticipatoryProcessStep model for the activation time
    - Add the field to the step configuration UI
    - Create a new ActiveJob that searches through all steps with activation time set and in the past, activate all these steps and after activation, clear the activation time field.

    The biggest question with this is that how is the scheduling done. I.e. which program is run at specific intervals to schedule this job to run every day, every hour, every 30 mins, every minute, etc. And how to decide how often it is run (I believe it should be up to the system administrator). There are different scheduler applications available with different requirements that work in different environments. Easy option for linux servers would be whenever but it does not work e.g. with Heroku as discussed in the original GitHub issue. Some others require e.g. Redis which is not a requirement for Decidim.

    0 votes up 0 votes down
    1. And how do you make it compatible with different background processing applications that can be used with Decidim (e.g. Redis, Sidekiq, Delayed Jobs, etc.).

      There are solutions that would support all use cases, such as the clockwork gem. It runs as a separate process and does not depend e.g. on the availability of Redis or Cron on the machine. The bad part of that is that it's then yet another process that needs to be run alongside with Decidim, requiring all Decidim's requirements and takes yet another bunch of of memory.

      The hard part is to find a solution that suits all possible configurations, is efficient and does not add any unnecessary dependencies in the core (e.g. Redis which has been removed in the past as a core requirement).

      0 votes up 0 votes down
  3. @ah @carol we would like to start working on this feature as commented in our proposal:

    Automate phase change in processes

    It's basically the same as yours and Opensource Politic's.

    I'll elaborate on the issue you made some time ago

    0 votes up 0 votes down
    1. Hi @ you have green light from @product. Let's continue the discussion in the issue. Thanks!

      1 votes up 0 votes down

Sign in with your Atmosphere account to comment.