使用 runt 在 ruby​​ 中执行重复的非每周事件(每两周一次、每三周一次等)

发布于 2024-08-07 22:32:16 字数 315 浏览 10 评论 0原文

我需要能够创建在特定日期发生但不一定每周发生的重复事件。它们可以安排为每两周一次、每三周一次等。当前的实现需要更新,我想使用来自 runt 重做它。

Runt 可以满足我的需要,但它似乎无法处理非每周事件的间隔。它增加了一些复杂性,因为事件还需要捕获开始日期,以便您可以准确计算哪些周触发事件以及哪些周忽略它们。我认为我可以重新设计 runt 来做到这一点,但如果有人已经解决了这个问题,或者有更好的解决方案,我宁愿不重新发明轮子。有什么建议吗?

I need to be able to create recurring events that happen on specific days but don't necessarily happen every week. They could be scheduled bi-weekly, every 3 weeks, etc. There is a current implementation that needs an update and I'd like to use the temporal expressions stuff from runt to redo it.

Runt will work for what I need except it doesn't seem to handle the intervals for non-weekly events. It adds some complexity because the event also needs to capture a start date so you can accurately compute which weeks to fire the events and which to ignore them. I think I can rework runt to do this, but I'd rather not reinvent the wheel if somebody has already tackled it, or there is a better solution out there. Any suggestions?

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

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

发布评论

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

评论(2

亢潮 2024-08-14 22:32:16

您不清楚,您是否连续运行脚本来执行此操作?如果是这样,为什么不使用“at”之类的东西。

如果这是一个日程安排应用程序,您是否看过:
http://icalendar.rubyforge.org/

You aren't clear, are you running a script continiously to do this? If so why not use something like "at".

If this is a scheduling application have you looked at:
http://icalendar.rubyforge.org/

淡紫姑娘! 2024-08-14 22:32:16

我决定将我需要的东西构建到 runt 中。我已经获得了初步支持(以 REWeekWithIntervalTE 类的方式,该类需要开始日期、间隔和工作日或工作日数组)。如果有人有兴趣玩它,你可以查看我的 fork。抱歉,我在最初的问题中没有更清楚地了解这是一个日程安排问题。

I've decided to build what I needed into runt. I've got the initial support already in (in the way of a REWeekWithIntervalTE class that takes a start date, interval, and weekday or array of weekdays). If anybody is interested in playing with it you can check out my fork. Sorry for not being more clear in my initial question about it being a scheduling issue.

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