开发/管理/设计重复任务/日历的最佳方法 [英] Best way to develop/manage/design recurring tasks/calendar

查看:266
本文介绍了开发/管理/设计重复任务/日历的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所谈论的示例与Google日历类似.创建新的重复任务时.

An example of what I'm talking about is similar to Google Calendar. When a new recurring task is created.

创建重复任务模板"后-所有单个任务都基于该模板,您是否创建所有单个任务并将其存储在数据库中?还是只存储模板"重复事件及其异常?

After creating the recurring task "template" - which all of the individual tasks are based on, do you create all of the individual tasks and store them in the database? or do you just store the "template" recurring events and their exceptions?

如果用户请求一个月"视图,并且您想显示所有事件/任务,则好像是从模板实时创建输出,并且包括所有异常会占用更多资源如果模板中创建了每个单独的重复任务并插入到数据库中,则需要进行大量操作.

If the user requests a "month" view, and you want to display all of the events/tasks, it seems like creating the output in real time from the template, and including all of the exceptions would be a lot more resource intensive then if each individual recurring tasks was created from the template and inserted into the database.

这将使搜索/排序等更加容易.

This would make searching/sorting, etc, a lot more easier too.

有人以前创建过这样的东西吗?想法?

Anybody create something like this before? ideas?

推荐答案

将其全部存储在数据库中.

Store it all in the database.

您要有一个任务模板"表和一个任务"表,其中存在一个->许多关系.

You want to have a "Task Template" table and a "Task" table where there is a one->many relationship.

当用户指示他们希望再次执行任务时,创建任务模板"记录,然后创建用户指示的尽可能多的任务"(不允许用户创建太远的任务) .每个任务都通过外键链接到任务模板.想法是,与尝试基于一个模板在代码中完成所有这些操作相比,SQL在管理这些记录方面将更加有效.这样,在排序和过滤数据时,您将有更多选择.毕竟,编写SQL查询比编写,测试和维护可操纵数据的PHP函数要容易.

When the user indicates they want a task to reoccur, create a "Task Template" record and then create as many "Tasks" as the user has indicated (don't allow a user to create tasks too far into the future). Each Task is linked to the Task Template via a Foreign Key. The idea is that SQL is going to be more efficient at managing these records than trying to do this all in code based on one template. This way, you will have more option when your sorting and filtering your data. After all, writing a SQL query is easier than writing, testing, and maintaining a PHP function that manipulates the data.

我要给你的一些其他提示是:

Some other tips I would give you is:

  • 尝试在任务模板"记录中获取很多信息.保留模板涵盖的任务数,最后一个任务的结束日期,第一个任务和最后一个任务之间的时间等.此元数据"可以帮助您节省查找时间,以进行排序和过滤任务.
  • 在日期和FK"字段上放置一个索引,这也将有助于查询时间.
  • 我刚刚在工作中构建了两个日历应用程序,这些应用程序很受老板欢迎.我使用了"FullCalendar" JQuery插件(http://arshaw.com/fullcalendar/).我使用JQuery AJAX来处理大多数事件,并且它内置了对Month,Day和Week视图的支持.

这篇关于开发/管理/设计重复任务/日历的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆