在日历应用程序中模拟重复事件的最佳方法是什么? [英] What's the best way to model recurring events in a calendar application?

查看:38
本文介绍了在日历应用程序中模拟重复事件的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个需要支持重复事件的群组日历应用程序,但我为处理这些事件而提出的所有解决方案似乎都是一种黑客行为.我可以限制一个人可以看多远,然后一次生成所有事件.或者,我可以将事件存储为重复事件,并在日历上向前看时动态显示它们,但如果有人想要更改特定事件实例的详细信息,我必须将它们转换为普通事件.

I'm building a group calendar application that needs to support recurring events, but all the solutions I've come up with to handle these events seem like a hack. I can limit how far ahead one can look, and then generate all the events at once. Or I can store the events as repeating and dynamically display them when one looks ahead on the calendar, but I'll have to convert them to a normal event if someone wants to change the details on a particular instance of the event.

我确信有更好的方法可以做到这一点,但我还没有找到.对重复事件建模的最佳方法是什么,您可以在其中更改特定事件实例的详细信息或删除特定事件实例?

I'm sure there's a better way to do this, but I haven't found it yet. What's the best way to model recurring events, where you can change details of or delete particular event instances?

(我使用的是 Ruby,但请不要让这限制了您的答案.如果有特定于 Ruby 的库或其他什么东西,那很高兴知道.)

(I'm using Ruby, but please don't let that constrain your answer. If there's a Ruby-specific library or something, though, that's good to know.)

推荐答案

对于所有未来重复发生的事件,我会使用链接"概念.它们在日历中动态显示并链接回单个参考对象.当事件发生时,链接断开,事件成为独立实例.如果您尝试编辑重复事件,则提示更改所有未来项目(即更改单个链接引用)或仅更改该实例(在这种情况下,将其转换为独立实例,然后进行更改).后一种情况有点问题,因为您需要在您的重复列表中跟踪所有转换为单个实例的未来事件.但是,这是完全可行的.

I would use a 'link' concept for all future recurring events. They are dynamically displayed in the calendar and link back to a single reference object. When events have taken place the link is broken and the event becomes a standalone instance. If you attempt to edit a recurring event then prompt to change all future items (i.e. change single linked reference) or change just that instance (in which case convert this to a standalone instance and then make change). The latter cased is slightly problematic as you need to keep track in your recurring list of all future events that were converted to single instance. But, this is entirely do-able.

因此,本质上,有两类事件 - 单个实例和重复事件.

So, in essence, have 2 classes of events - single instances and recurring events.

这篇关于在日历应用程序中模拟重复事件的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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