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

Delete old calendar events before creating new ones #786

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jack-tii
Copy link
Contributor

@jack-tii jack-tii commented Dec 4, 2024

We are currently creating duplicate events in the Moodle calendar when we change the name of a TT assignment part. This is because in our logic to update an existing calendar event we find the event using a sql query with the event name. Since the name has just been changed, we look for the event using the new name and fail to find it, so instead of updating the old record a new one is created. To fix this I delete the event before updating the name. After that the name is updated, the new event is created.
You may very well ask why we don't just store the ID of the event as a foreign key in the TT database table. To that I say good question. I agree this would be a better solution, but it would require adding database fields and would not be backward compatible when migrating plugin versions. Also it is possible to create additional events and link them to a TT assignment, further complicating things. Ideally a full rewrite of the way we handle events would be in order, but for now this will suffice to fix the bug we are seeing.

Copy link

snyk-io bot commented Dec 4, 2024

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant