Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

97 wip #100

Merged
merged 13 commits into from Nov 16, 2022
Merged

97 wip #100

merged 13 commits into from Nov 16, 2022

Conversation

tobixen
Copy link
Collaborator

@tobixen tobixen commented Nov 4, 2022

Apparently this doesn't work
#97

@tobixen tobixen force-pushed the 97-wip branch 2 times, most recently from 51d4b03 to f192acb Compare November 4, 2022 12:01
Copy link
Owner

@niccokunzmann niccokunzmann left a comment

Choose a reason for hiding this comment

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

I sent a few comments. I might chip in some code later but am quite busy, too.

recurring_ical_events.py Show resolved Hide resolved
@@ -130,13 +130,14 @@ def __init__(self, source, start, stop, keep_recurrence_attributes=False):
self.source = source
self.start = start
self.stop = stop
self.end_prop = end_prop
Copy link
Owner

Choose a reason for hiding this comment

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

This is in conflict with clarity and the class attribute.

@@ -10,6 +10,8 @@ def test_event_has_summary(calendars):
def test_recurrent_events_change_start_and_end(calendars, attribute):
events = calendars.three_events_one_edited.all()
print(events)
if events[0][attribute].__hash__ is None:
Copy link
Owner

Choose a reason for hiding this comment

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

no. The test becomes worthless.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an independent issue that should be fixed properly in a separate pull request. I chipped in this code just to get the tests to pass. I did try to hash event[attribute].dt, but then the asserts failed ... hm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I sent a few comments. I might chip in some code later but am quite busy, too.

It's good to coordinate that we don't work at the same things at the same time :-) I will apparently be busy for the rest of the day.

@tobixen
Copy link
Collaborator Author

tobixen commented Nov 12, 2022

@niccokunzmann - I did not quite get the problem with having a class.end_prop variable?

Except for that, obviously the disabled test (ref collective/icalendar#487) should be reenabled again before the pull request is to be considered to be ready.

@tobixen
Copy link
Collaborator Author

tobixen commented Nov 12, 2022

There is quite some code here to handle the case where DTSTART is not set for journals and tasks (as mentioned, there may be corner-cases out there related to scheduling where DTSTART is not set even for events). I'm not sure if it makes sense to combine a RRULE with something that doesn't have DTSTART EDIT: I suppose a tasks like "clean the floor if it's a week since last time it was done" may be described as a VTODO without a DTSTART but with a RRULE. Anyway, it doesn't make sense trying to calculate the future recurrences for something that is missing a DTSTART. Probably a lot more test cases can/should be written up ...

@niccokunzmann
Copy link
Owner

niccokunzmann commented Nov 12, 2022 via email

@tobixen
Copy link
Collaborator Author

tobixen commented Nov 13, 2022

I wouldn't call it a "major restructuring" - I just split one class into one superclass and three child classes, keeping most of the original logic in the super class :-)

@niccokunzmann
Copy link
Owner

niccokunzmann commented Nov 13, 2022 via email

"""Create an event which may have repetitions in it.

- event - the icalendar Event
- object - the icalendar object
Copy link
Owner

Choose a reason for hiding this comment

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

These are called components, I think.

@@ -130,13 +130,14 @@ def __init__(self, source, start, stop, keep_recurrence_attributes=False):
self.source = source
self.start = start
self.stop = stop
self.end_prop = end_prop
self.keep_recurrence_attributes = keep_recurrence_attributes

def as_vevent(self):
Copy link
Owner

Choose a reason for hiding this comment

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

My guess is that this will be part of the subclass, too..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is one single place relatively deep in a method in the super class that uses this one. I didn't see any obvious way to move that logic to the subclasses without adding code duplication. You're welcome to have a look though :-)

@niccokunzmann
Copy link
Owner

niccokunzmann commented Nov 16, 2022

Hm. Architecture wise, I'd think composition through strategy pattern instead of subclassing might me clearer. It divides the repetition calculation from the extraction of information from components and the composition of the repeated components.

@tobixen
Copy link
Collaborator Author

tobixen commented Nov 16, 2022 via email

@tobixen
Copy link
Collaborator Author

tobixen commented Nov 16, 2022

Hm. Architecture wise, I'd think composition through strategy pattern instead of subclassing might me clearer. It divides the repetition calculation from the extraction of information from components and the composition of the repeated components.

Sounds like a lot of refactoring - I don't have the capacity for that :-)

@niccokunzmann
Copy link
Owner

niccokunzmann commented Nov 16, 2022 via email

@niccokunzmann
Copy link
Owner

Uh. The tests are running! I will have a look now ...

@niccokunzmann niccokunzmann marked this pull request as ready for review November 16, 2022 21:59
@niccokunzmann
Copy link
Owner

Okay. I will merge this now. I is a lot more usable for your use-case than the code before and it does not break any existing code.

@niccokunzmann niccokunzmann merged commit f5c7bf5 into niccokunzmann:master Nov 16, 2022
@niccokunzmann niccokunzmann mentioned this pull request Nov 16, 2022
3 tasks
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.

None yet

2 participants