Skip to content

Fix recurrence IDs after THISANDFUTURE overrides - #285

Open
bensynapse wants to merge 2 commits into
niccokunzmann:mainfrom
bensynapse:fix-range-recurrence-id
Open

bensynapse wants to merge 2 commits into
niccokunzmann:mainfrom
bensynapse:fix-range-recurrence-id

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

Expanded instances of a moved range currently reuse the override's RECURRENCE-ID. Editing one can replace the wrong occurrence.

Each result now identifies its original scheduled date. RANGE is omitted by default and retained with keep_recurrence_attributes=True. The source calendar stays unchanged.

Fixes #222.

tox -e py38,py314 -- -q --tb=short passes 3,497 tests on each Python version, with six existing skips. The regressions cover dates, floating times, UTC and Berlin across daylight saving changes. They also check editing one occurrence after a range move. Both failures were reproduced on unchanged upstream.

tox -e build passes. The configured pre-commit hooks pass on the changed files. Running them across the repository finds the same three docs/conf.py diagnostics on both branches: INP001, DTZ011 and A001.

tox -e docs exits 0 on both branches. Both report the same two indentation errors and one warning from the typing.Tuple docstring.

@niccokunzmann niccokunzmann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is good work!

I like the thoroughness of the tests.

Could you have a look at the suggestions?

def test_edit_one_event_after_range_move(tzp):
"""An exported occurrence can be edited without moving the whole range."""
tzp()
calendar = Calendar.from_ical("""BEGIN:VCALENDAR

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this into the calendars directory and use the calendars feature?

)
assert recurrence_ids == expected
for expanded in events:
if expanded["DTSTART"].dt != start:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you move it two days back in one case, you should get a duplication here.
Does this work?

Suggested change
if expanded["DTSTART"].dt != start:
if expanded["RECURRENCE-ID"].dt != start:

assert (
"RANGE" in expanded["RECURRENCE-ID"].params
) == keep_recurrence_attributes
assert calendar.to_ical() == original

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert calendar.to_ical() == original
assert calendar.to_ical() == original, "Recurrence calculation must not change the calendar"

Is that the intention? Nice idea!

@bensynapse

Copy link
Copy Markdown
Author

Pushed 486b398. The calendars now use fixtures from the calendars directory.
The backward move does produce two events with the same DTSTART. Comparing RECURRENCE-ID checks the moved occurrence too.
I also added your assertion message about leaving the source calendar unchanged.
The configured hooks pass. tox -e py38,py314 passes 3,567 tests on each version, with six skips.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

THISANDFUTURE recurrence id

2 participants