Ticket #728 (closed defect: fixed)

Opened 3 months ago

Last modified 3 months ago

Off-by-one in moto-sync exception handling

Reported by: swolter Assigned to: swolter
Priority: normal Milestone:
Component: Plugin: moto Version: 0.39
Severity: normal Keywords:
Cc:

Description

When computing the offsets for exception dates, moto-sync will index the offsets starting with the first occurence being 0, not 1 as expected by the phone. Accordingly, the exception for May 1 will result in the removal of the Apr 24 event.

Patch attached.

Attachments

moto-sync-exc-offset.patch (425 bytes) - added by swolter on 04/15/08 22:57:15.
Correct patch this time

Change History

04/15/08 22:57:15 changed by swolter

  • attachment moto-sync-exc-offset.patch added.

Correct patch this time

04/16/08 11:40:55 changed by swolter

  • severity changed from minor to normal.

Actually, I got the cause of this bug wrong here: The exceptions are not counted from the current date on, but rather from the first occurrence. Thus, it's not off-by-one, but rather off-by-number-of-prior-occurrences, which happened to be one here.

I'll give you a patch soon.

04/16/08 11:45:18 changed by swolter

Sorry, can't give you a patch right away because I've got an improvement here I'll post into another ticket.

The changes needed are an addition of a line like

offset =  len(ruleset.between(eventdt, now, True))

at line 567 (right after computation of all_occurrences) and replacing

ret['exceptions'].append(num)

by

ret['exceptions'].append(num+offset)

04/17/08 08:54:07 changed by swolter

  • owner changed from andrewb to swolter.

04/17/08 09:05:10 changed by swolter

  • status changed from new to closed.
  • resolution set to fixed.

Applied that patch to SVN.