重复任务,如何用代码实现

发布于 2024-12-12 04:12:21 字数 270 浏览 0 评论 0原文

我正在开发任务管理器应用程序,并且想要添加重复/重复任务功能。我一直在思考如何让它发挥作用,但无法真正弄清楚其中的机制,以及重复任务如何在未来的某个时间范围内重新创建自己。

假设我将从下周开始每周一的 8:00 创建一个重复任务。现在假设我在接下来的 3 周内不使用该应用程序,那么当我打开该应用程序时,我是否应该看到过去 3 周的每一周有 3 个任务?或者只是下周一的新任务?如果我选择第一个选项,我什么时候需要创建这些任务,当用户打开应用程序或退出时?

如果有人能详细说明这一点,我会很好。

I'm working on a task manager app and want to add a recurring/repeating tasks feature. I have been thinking on how to get this working but can't really figure out the mechanics, how a recurring task recreate itself some time-frame in the future.

Suppose I would create a recurring task for every Monday at 8:00 starting from next week. Now suppose I don't use the app for the next 3 weeks, then when I open the app should I see 3 task for each of the last 3 weeks ? Or only a new task for the next Monday ? In case I would choose the first option, when do I need to create those task, when the user opens the app or when he exits ?

I would be great if some could elaborate on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悟红尘 2024-12-19 04:12:21

现在假设我在接下来的 3 周内不使用该应用程序,那么当我打开该应用程序时,我应该看到过去 3 周的每一周有 3 个任务吗?

这完全取决于你。如果您使用您的应用程序,您会更喜欢哪个?就我个人而言,我更希望旧的任务无论如何都存在,但其他人可能会有不同的感觉。选择一个或在您的设置中为用户提供一个选项。

如果我选择第一个选项,我什么时候需要创建这些任务,当用户打开应用程序时或退出时?

我认为正确的选择是在任务第一次可见时创建任务。例如,如果您有日历,请在第一次向用户显示该日/月/周时创建任务。这样您就可以只在需要时创建任务。

我必须强调一点,这实际上取决于您如何向用户呈现此信息。

Now suppose I don't use the app for the next 3 weeks, then when I open the app should I see 3 task for each of the last 3 weeks ?

This is entirely up to you. If you were using your app which would you prefer? Personally I would prefer that the old tasks are there regardless, but others might feel otherwise. Pick one or offer the user an option in your settings.

In case I would choose the first option, when do I need to create those task, when the user opens the app or when he exits ?

I think the right choice is to create the task when it becomes visible for the first time. For example, if you have a calendar, create the task the first time you display that day/month/week to the user. This way you are only creating tasks as they are needed.

I cannot stress enough though that it really depends on how you are presenting this information to the user.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文