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

Modifying event duplicates persisted occurrences #4

Open
bartekgorny opened this issue Jan 18, 2011 · 5 comments
Open

Modifying event duplicates persisted occurrences #4

bartekgorny opened this issue Jan 18, 2011 · 5 comments

Comments

@bartekgorny
Copy link
Owner

If you change start/end of an event which has some persisted occurrences, the original occurrences reappear thus causing duplication (reported by gautamadude).

@bartekgorny
Copy link
Owner Author

There is a test which currently fails.

There is a reference page with some insight here: https://github.com/bartekgorny/django-schedule/wiki/Modifying-events - solving the issue requires some design decisions relating to logic rathere then implementation.

@keiouu
Copy link

keiouu commented Sep 12, 2011

I fixed this by doing the following:

models/events.py:
class Event(models.Model):
def _get_occurrence_list(self, start, end):

line 135:
occurrences.append(self._create_occurrence(o_start, o_end))
changed to:
occurrences.append(self.get_occurrence(o_start))

But I'm not sure if this breaks anything elsewhere... everything worked in my project..

This worked for me because:

  • I believe if one occurrence is edited, it is an exception to a rule for example: a sick day caused the work schedule to change
  • I believe that exception should become a separate entity, as it is an exception..
    • Could have a setting so the user can change this.

@bartekgorny
Copy link
Owner Author

On Mon, 12 Sep 2011 07:07:04 -0700
James Thompson
[email protected]
wrote:

I fixed this by doing the following:

models/events.py:
class Event(models.Model):
def _get_occurrence_list(self, start, end):

line 135:
occurrences.append(self._create_occurrence(o_start, o_end))
changed to:
occurrences.append(self.get_occurrence(o_start))

But I'm not sure if this breaks anything elsewhere... everything
worked in my project..

Did you run tests?

BG

Do you know, where your towel is?
(re: Hitchhikers Guide to the Galaxy)

@keiouu
Copy link

keiouu commented Sep 13, 2011

No new tests fail, I get 2 failed tests with HEAD but the change doesn't introduce any new failures.
The broken tests are testing for "orphaned" occurrences, however.. it is the "exception" occurrences that are tested.

As you said it is a design decision and one that I am not in a position to make, however, I do feel that exceptions to a rule are no longer part of that rule, as they would break it.

The main point of this change is as follows:

  • Create a recurring event
  • Modify one element
  • Modify "all" of the other occurring events
    • in HEAD, a new occurrence will be created on top of the one you modified
    • with this change, no new occurrence will be created

edit - it seems this only fixes one side of the issue.. I'm working on a better fix now
the best thing I can think of is to use "sequences"

@keiouu
Copy link

keiouu commented Sep 13, 2011

Unfortunately in order to "properly" fix it, I ended up "updating" the start and end dates for occurrences:
keiouu@c17cb67

The tests all pass with the above commit but.. the solution isn't exactly ideal.. it works for my project though. I'll leave you to decide :)

Note: There is a print statement that wasn't meant to be there, sorry.

boardman pushed a commit to boardman/django-schedule that referenced this issue Nov 26, 2013
prevent false matches for 'schedule' url
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

No branches or pull requests

2 participants