Hi Sam Thanks for a great piece of software. I''m working on a project that needs recurrence of the sort: FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH but looking at test_rrule.rb:275 it seems the BYDAY feature isn''t implemented. I''m guessing this: "TODO - BYWEEKLY, BYWEEKNO, WKST: rules that recur by the week, or are limited to particular weeks, not hard, but not trivial, I?ll do it for the next release" from the documentation refers to BYDAY as well? Any update on the status of this? I could go about implementing it, if you don''t plan or want to. Any hints would be greatly appreciated. Thanks, /Lars Pind -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/vpim-talk/attachments/20060522/3fa4862a/attachment.htm
Quoting lars at pinds.com, on Mon, May 22, 2006 at 11:43:05AM +0200:> I''m working on a project that needs recurrence of the sort: > > FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH > > but looking at test_rrule.rb:275 it seems the BYDAY feature isn''t > implemented.BYDAY is supposed to beimplemented, see test_rrule.rb:190 for an example, but trying your example definitely doesn''t work for me. It has nothing to do with WKST, though, this is broken, too: % ruby -Ilib rrule.rb --start ''2006-05-04'' ''FREQ=WEEKLY;COUNT=5;BYDAY=WE,TH'' Start: Thu May 04 00:00:00 PDT 2006 Rrule: FREQ=WEEKLY;COUNT=5;BYDAY=WE,TH count= 0 Thu May 04 00:00:00 PDT 2006 count= 1 Thu May 11 00:00:00 PDT 2006 count= 2 Thu May 18 00:00:00 PDT 2006 count= 3 Thu May 25 00:00:00 PDT 2006 count= 4 Thu Jun 01 00:00:00 PDT 2006 Should be weds and thursdays, but its only thursdays. Thats a bug in the BYDAY, it looks like.> I''m guessing this: > > "TODO - BYWEEKLY, BYWEEKNO, WKST: rules that recur by the week, or > are limited to particular weeks, not hard, but not trivial, I?ll do > it for the next release" > > from the documentation refers to BYDAY as well?No, I thought BYDAY worked fine, turns out its broken.> I could go about implementing it, if you don''t plan or want to. Any > hints would be greatly appreciated.WKST is important only in very specific scenarios, but not in your example, I don''t think, so maybe you don''t need it. Perhaps you can get away with just fixing the BYDAY implementation? I''m sorry, I just don''t have the time to do this. It might be easy, you''ll have to look at vpim/rrule.rb. Thanks Sam
Actually, I''ve looked a bit closer at the code, and it turns out that rrule.rb:232, which deals with BYDAY when FREQ=WEEKLY is commented out! when ''WEEKLY'' # dates = byday_in_weekly(t.year, wkstart, t.month, t.day, byday) Moreover, the byday_in_weekly method doesn''t exist. Should be fairly easy to do, I suspect. I''ll look into it when it gets critical for my needs. Will you accept patches and have time to put out a new release? Thanks, /Lars On May 22, 2006, at 11:39 PM, Sam Roberts wrote:> Quoting lars at pinds.com, on Mon, May 22, 2006 at 11:43:05AM +0200: >> I''m working on a project that needs recurrence of the sort: >> >> FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH >> >> but looking at test_rrule.rb:275 it seems the BYDAY feature isn''t >> implemented. > > BYDAY is supposed to beimplemented, see test_rrule.rb:190 for an > example, but trying your example definitely doesn''t work for me. > It has > nothing to do with WKST, though, this is broken, too: > > % ruby -Ilib rrule.rb --start ''2006-05-04'' > ''FREQ=WEEKLY;COUNT=5;BYDAY=WE,TH'' > Start: Thu May 04 00:00:00 PDT 2006 > Rrule: FREQ=WEEKLY;COUNT=5;BYDAY=WE,TH > count= 0 Thu May 04 00:00:00 PDT 2006 > count= 1 Thu May 11 00:00:00 PDT 2006 > count= 2 Thu May 18 00:00:00 PDT 2006 > count= 3 Thu May 25 00:00:00 PDT 2006 > count= 4 Thu Jun 01 00:00:00 PDT 2006 > > Should be weds and thursdays, but its only thursdays. > > Thats a bug in the BYDAY, it looks like. > >> I''m guessing this: >> >> "TODO - BYWEEKLY, BYWEEKNO, WKST: rules that recur by the week, or >> are limited to particular weeks, not hard, but not trivial, I?ll do >> it for the next release" >> >> from the documentation refers to BYDAY as well? > > No, I thought BYDAY worked fine, turns out its broken. > >> I could go about implementing it, if you don''t plan or want to. Any >> hints would be greatly appreciated. > > WKST is important only in very specific scenarios, but not in your > example, I don''t think, so maybe you don''t need it. Perhaps you can > get > away with just fixing the BYDAY implementation? > > I''m sorry, I just don''t have the time to do this. It might be easy, > you''ll have to look at vpim/rrule.rb. > > Thanks > Sam > > _______________________________________________ > Vpim-talk mailing list > Vpim-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/vpim-talk
Quoting lars at pinds.com, on Mon, May 22, 2006 at 11:47:51PM +0200:> Actually, I''ve looked a bit closer at the code, and it turns out that > rrule.rb:232, which deals with BYDAY when FREQ=WEEKLY is commented out!Oops. :-)> when ''WEEKLY'' > # dates = byday_in_weekly(t.year, wkstart, t.month, > t.day, byday) > > Moreover, the byday_in_weekly method doesn''t exist. > > Should be fairly easy to do, I suspect. I''ll look into it when it > gets critical for my needs. > > Will you accept patches and have time to put out a new release?Clean patches that keep in the sprit of the current code are easy to accept. I think implementing byday_in_weekly() should be in that category. Unit tests, at least uncommenting the ones in test_rrule from the RFC, would grealy help. I''m also trying to accept patches that don''t conform to how I want vPim to work, because I just don''t have the time to work on vPim, its taking time away from other things that are much higher priority. Releasing is pretty easy and fast. Thanks, Sam