# Repeating Rotating List without dates

Hoping to see if someone has an idea for what I am trying to accomplish. I’d like to create a set of tasks with no due date where after the last task is done, it starts again with the first task.

Example: 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5.

Additionally, hoping to be able to complete these tasks in no particular order. In the example above, if I wanted to complete task 2 I could close it, and then tasks 1,3,4,5 would remain. I wouldn’t want to be able to complete task 2 again until I was done with all 5.

Hope that makes sense :)

You’ll need a container for them, either a parent task or a project. Once you put the tasks inside you can set the parent to “complete with last action”, and make sure it’s parallel (that’s the default). Then in the parent toggle on Repeat and play with the options to figure it out. I would suggest “Defer again after completion” as it will let all 5 actions show up again tomorrow (and you can always modify the defer date!).

Thank you @rosemaryjayne! This seems to get me most of the way there. I went with a project for this and it looks like I have to set it to repeat in order for this to work don’t I. Ideally, I’d like for it to not repeat in case I don’t complete the 1,2,3,4,5 tasks in time. But I think I can make this work. I appreciate you!

@SeePlanet, another approach would be using a script to create a cycle from selected tasks of `n` length.

Change this line to suit your needs:

``````// Cycle length...
n = 7
``````

From:

To (for n = 7):

``````(() => {
// Paste in Automation Console...
// main :: IO ()
const main = () => {
const
// Cycle length...
n = 7;

const
parent = seln[0].parent,
ts = take(n)(
cycle(seln)
);

return (
ts.forEach(x =>
),
`Created a cycle of \${
n
)
};

// FUNCTIONS --
// https://github.com/RobTrew/prelude-jxa
// JS Prelude --------------------------------------------------
// concat :: [[a]] -> [a]
// concat :: [String] -> String
const concat = xs =>
0 < xs.length ? (
(
xs.every(x => "string" === typeof x) ? (
""
) : []
).concat(...xs)
) : xs;

// cycle :: [a] -> Generator [a]
const cycle = function* (xs) {
// An infinite repetition of xs,
// from which an arbitrary prefix
// may be taken.
const lng = xs.length;
let i = 0;

while (true) {
yield xs[i];
i = (1 + i) % lng;
}
};

// length :: [a] -> Int
const length = xs =>
// Returns Infinity over objects without finite
// length. This enables zip and zipWith to choose
// the shorter argument when one is non-finite,
// like cycle, repeat etc
"GeneratorFunction" !== xs.constructor
.constructor.name ? (
xs.length
) : Infinity;

// take :: Int -> [a] -> [a]
// take :: Int -> String -> String
const take = n =>
// The first n elements of a list,
// string of characters, or stream.
xs => "GeneratorFunction" !== xs
.constructor.constructor.name ? (
xs.slice(0, n)
) : [].concat(...Array.from({
length: n
}, () => {
const x = xs.next();

return x.done ? [] : [x.value];
}));

return main();
})();
``````

Interesting approach! I opened the automation console and pasted that text in, but got this error. Any idea what I might have done wrong?

Do you have any selected tasks ? I’ll investigate further if that doesn’t solve the problem.

I’ve edited my post to make it more clear.

Ah! That worked. I didn’t have any items selected. As soon as I ran it, it created the same set of tasks below it. I haven’t used automation much before, would this run in any automated fashion to re-create each set of tasks? Or would I run this at a specific time? I imagine that if I were to complete some tasks and then run this, that it would only duplicate those tasks that are still not complete, correct?

This automation is going to duplicate every selected task (completed or not). What would be your ideal configuration ?

If you set the project to Parallel, then you should be able to complete the tasks in whatever order you wish. It’s only when the last uncompleted task is completed that the project itself completes and then creates the next one.

Actually, @rosemaryjayne’s solution is pretty great. I did set the project to repeat every minute and Defer Until Date and it seems to work exactly as you’d asked. Cool trick.

Ideally I would have those 5 tasks and work towards completing them. After all of them are completed, the new 5 tasks would be generated.

I would also be fine with the next task being generated after I close the first one, but that might be getting into the weeds.

For example: 1,2,3,4,5 are the 5 tasks. Complete #1 and have a new task be created after the last: 2,3,4,5,1. Or just keep 2,3,4,5 until all of them are complete and then generate a new 1,2,3,4,5.

To @Arasmus’ comments, the only challenge to that idea is that the project would repeat based on a time schedule. If I set the time to 1 week and can’t complete all of my tasks, then I wouldnt want the others to pile on. Hope that makes sense!

Ok, but specifically what kind of workflow would you want ? You complete the fifth task, hit a button and get a new set ?

Also, could you give some context ? Is this some kind of building skill or habit workflow ?

That’s what I’m saying. While the project is set to repeat (and defer) every minute, that does not happen until you complete the project, which happens only when you complete the last task. Then a new group of tasks immediately appears.

Hey @unlocked2412. I had some more time to think about this and try that code your provided again and this is turning out to provide me exactly what I need. So at this point, I think I am all set.

Thanks to you and the others for helping with this. Great community!

1 Like

I am glad it is useful for you, @SeePlanet. Welcome to the community.

FWIW, I did a Plug-In out of the script. It includes a dialog for quick cycle length selection dialog. You can download it from my GitHub repository:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.