Problem/Motivation

A common request is for farmOS to provide an easy way to manage recurring tasks, so that they always show up in your todo list daily/weekly/yearly/etc.

For example: https://github.com/farmOS/farmOS/issues/78

If farmOS were like a traditional calendar system, you would expect to be able to create a single log and give it a repeating rule (ie: "repeats weekly on monday"). Drupal has a Date Repeat module that would provide this capability. However, logs in farmOS have a key difference from other calendar systems: they can (and should) be marked "done". In a normal calendar, you generally don't have any concept of what was done and what wasn't. But in farmOS, the goal is to create a very specific archival record of things that actually happened. Any logs that are "not done" are considered to be a planned log. So, a single log with a repeat rule would not work, because you couldn't easily determine which ones were done and which ones weren't. We need a separate log to be created for each.

One approach might be to automatically create a whole bunch of logs in advance in the future. This would basically accomplish the goal, but it has a lot of drawbacks. For one, your future logs would be full of planned logs, which could add a lot of clutter. If you needed to change the rule, you would need to update all the logs. And, unlike a calendar where it's just single rule that goes on into infinity, we obviously can't create infinite logs into the future, so there would need to be some kind of cutoff.

Proposed resolution

I propose that we use the new "Plan" entity type and create a new type of plan called "Recurring tasks" or similar. This would allow you to create any number of "Recurring task plans" that define a set of tasks and the repeat rules for each of them. Then, it would automatically create a fixed number of logs for you in the future, and manage them so that you don't have to. Perhaps it could have settings for how many to create in advance and when to create them (ie: create 1 log 1 week before it is scheduled, so that you only ever have 1 weeks worth of repeating tasks on your calendar).

The plans would be linked to the logs, so that if you updated the rules it would propagate those changes automatically to the logs. Just like we are currently doing in the Grazing module. And if you archived a plan, it would stop creating those logs. So you can have an archive of all the "Recurring task plans" you've ever worked with in the past.

It might also be useful to have a setting to automatically delete tasks that you did NOT mark as done, after a period of time passes. So, if you stop using farmOS for a few weeks, you don't come back to find a whole bunch of auto-generated logs that you don't want.

Remaining tasks

...

User interface changes

...

API changes

...

Data model changes

...

Comments

m.stenta created an issue. See original summary.

bobombolo’s picture

i remember finding a drupal calendar module that handled this pretty good. you could project recurring tasks forward a few iterations but not too many because it was actually creating an entry for each one so if you made a mistake or changed the schedule you'd have to go delete them all. it had tools for every nth day of the week, every X number of days, every Xth day of the month, etc.
i also noticed that online banking handles this in a similar way, at least in the sense that you have to specify how many repetitions to create, you can't leave it open-ended...

m.stenta’s picture

Closed #2400099: Task templates in favor of this. Here are the ideas from that, originally suggested by @BruceDawson via email:

Something that just came up (again) and could be addressed is the
concept of "Farm Tasks" (plow field, feed cattle, fix fence, install
gate, ...)

I'd like to see "task templates" set up so workers can get their
required tools, managers set who can perform the task (out of a set of
people that are "trained" to do it) along with any details of the task,
and workers can annotate it with details of the execution. This sounds a
bit industrialized for a small farm, but I don't know how often I've
forgotten to take a tensioning wrench when going out to work on the
fences, or to check the fuel on the tractor when taking hay out to a
field.

Presentation of the above info would help farm managers schedule their
resources a bit better as well as helping workers do things more
efficiently.

m.stenta’s picture

Version: 7.x-1.x-dev » 2.x-dev
m.stenta’s picture

Status: Active » Closed (outdated)

Nothing has happened on this in a while, so I'm going to close this issue, but let's continue discussion in the forum and experiment in contrib modules or pull requests as necessary.