-
-
Notifications
You must be signed in to change notification settings - Fork 885
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
Fix Recurring Events #1583
Comments
Please assign me , i will work on this issue |
Please read the requirements. They have been frequently updated. |
Thank you for providing clarification on the requirements for this issue. I have carefully reviewed the outlined steps and understand the expectations for the solution. But, I'd like to request to give me some time to thoroughly investigate the issue. To ensure a comprehensive resolution, I plan to go through the codebase, understand the program's flow, and conduct a deep analysis of the problem before diving into the implementation. Rest assured, I'll keep you posted on my progress, and if there are any points where I require clarification or assistance, I won't hesitate to reach out for your guidance. Thank You |
Please work with @xoldyckk on this for updates, advice and general comments |
We don't want the creation of an infinite number of event calendar entries if a recurring event has no end date |
Yeah, got it. Will handle this with any of the following solutions:
I'm currently going through the issue , and I'm actively exploring all possible solutions. Once I've completed my analysis, I'll reach out @xoldyckk to discuss the process I plan to follow |
Whether graphql could solve this is another matter. |
Instead of implementing a linked list of recurring events, I have another, better, and more effective solution.
Here is a rough idea how we can implement this:Mongoose Schema const mongoose = require('mongoose');
const { Schema } = mongoose;
const recurringEventInstanceSchema = new Schema({
eventId: { type: Schema.Types.ObjectId, ref: 'Event', required: true },
start: { type: Date, required: true },
end: { type: Date, required: true },
//Accordingly more required fields can be added
});
const eventSchema = new Schema({
title: { type: String, required: true },
start: { type: Date, required: true },
end: { type: Date, required: true },
frequency: { type: String, required: true },
interval: { type: Number, required: true },
recurring: {type: boolean}, //Either true or false
//Accordingly more required fields can be added
});
const RecurringEventInstanceModel = mongoose.model('RecurringEventInstance', recurringEventInstanceSchema);
const EventModel = mongoose.model('Event', eventSchema); GraphQL mutation Mutation: {
createEvent: async (_, { event }) => {
try {
const createdEvent = await EventModel.create(event);
// If the event is recurring, generate and store individual instances
if (createdEvent.recurring) {
await generateRecurringEventInstances(createdEvent);
}
return createdEvent;
} catch (error) {
throw new Error('Error creating event');
}
}
}; According to this approach, we can generate a query for updating individual events with the unique event ID. I believe this will be the most efficient solution to solve this issue. What is your opinion on this? |
Your mutation logic for handling edits could be tricky, including.
|
Thanks for providing detailed information. I've reviewed the Google Calendar approach and the I'll prioritize implementing the basic functionality first, aligning with Google Calendar's method. Once that's completed and the initial PR is merged, we can address the additional complexities and customizations, such as accommodating different recurrence patterns. I'll keep you posted on the progress, and we can open follow-up issues as needed. Thanks for your guidance, and let's move forward with this plan |
I am almost prepared to create a pull request for this issue but require some clarifications. I've included the same fields for recurring events as those for regular events, adding only one more field: 'parentEvent.' Everything else, including both GraphQL input and type, remains unchanged. Do I need to make any additional additions or removals? recurring Event Model |
According to the Stack Overflow post Google calendar:
This seems like a relatively simple methodology. Is that what you are planning? We need to ensure as much backward compatibility as possible with the Talawa client apps that expect this feature to work. |
I think we'll need to split this up into multiple PR with child issues:
|
The logic is nearly the same: when a Talawa end user creates a recurring event, the This is the approach I am considering. I would appreciate your insights on it. Thank You |
Ok, breaking down the tasks into multiple pull requests (PRs) with child issues is a thoughtful approach. |
Why not assume all events are recurring with 0 to N repetitions? With 0 repetitions it would just generate a single event. That way you don't need a separate mutation. Then if a single event were made recurring, it would be easier logic, wouldn't it? |
I appreciate your suggestion, and it's valid. Initially, I opted for a separate mutation to enhance clarity and understanding of the codebase. However, upon further consideration, I agree that maintaining a single mutation could simplify the logic without compromising functionality. I'll made the adjustment accordingly. Thank you for your guidance |
OK. Please open a PR when ready with the appropriate tests. I'd suggest thinking of all the various parameters to use in the mutation and implement them one at a time. We need to change the sample database to include weekly recurring events so that a full calendar will always be visible. This will help other developers get a sense of what we're trying to achieve. There's a separate issue for that. Think of how we could support this first, possibly with a Talawa Admin collaborator to add a weekly option when creating an event. A checkbox to start with more UI friendly options later. Remember we need to create incremental PRs to fix incrementally advancing functionality. At some point we'll have multiple people working simultaneously on the mutation logic which will cause merge conflicts. Think of ways of simply refactoring the logic into classes (or something equivalent), each residing in a separate file to reduce the risk without making the code hard to follow. Hopefully this would allow us to delegate sequencing work a class/file at a time. For example, classes for weeks, months, days, weekdays and all the customizations within those time frames that could occur. All tied together with the standard event generation and regeneration logic. There may be better ways that you could think of too. |
There are two schema generators at the end of this GitHub action file. One of them exports markdown files that we commit to the Talawa Docs repo to create the Talawa website. It will have the information you require on how to document your schema code to make the markdown user friendly |
Sure, I'll follow your suggestions and work on implementing the mutation logic for the weekly recurring events. I'll start by considering various parameters and implementing them one at a time, as you've suggested. I'll keep you updated on the progress and ensure that the PRs are created with appropriate tests. Thank You |
Can I raise the PR after this issue is resolved. |
@Community-Programmer Please resubmit the PR as it was merged without realizing that there were reviewer comments |
@palisadoes Ok, I appreciate the feedback. I will resubmit the PR with the suggested changes as per the reviewer's comments. |
Yes, I'm adding comments at every step. I realize the
But maybe I'm overthinking this for now. Would that be ok? |
Do it the Google way |
What else is outstanding? |
Delete functionality. After that, basic CRUD for recurring events would be done. |
Currently, when we delete single events with Could you please elaborate on the purpose of these distinct mutations, and the event status " Lastly, how do we want them to work for recurring events, when delete multiple/single instances. |
|
That's what I wanted to know. I asked because separate mutations were made and tested. What was the original purpose of the
Yes, it's not being used, and neither is The query for events currently returns all the |
I hope this message finds you well. I wanted to express my deepest gratitude for stepping in and handling this issue while I am deeply engrossed in my exams. Your willingness to take on this responsibility means more to me than words can convey |
Keeping the DELETED flag adds to the confusion as in certain cases the recurring events are physically deleted, versus just having the flag being set. |
I think the So, I'm deleting the documents (from database) when deleting an event, rather than changing its We could fix it later if it causes some breaking change. |
OK. Remove the status code too. |
Ofcourse brother, your research and discussion on this issue played a major part. It helped a lot! |
I have removed it from the delete event mutation (For single events too). |
|
Yes.
Yes, I'll open an issue in |
Can I open an issue for recurring events in admin? I could start implementing the features, and make corrections to the backend (wherever/if required) along the way. |
Yes |
Note
This is a very important feature to implement.
In summary:
Describe the bug
The creation of a recurring event only creates a single event in the API clients.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Actual behavior
Screenshots
Additional details
3rd week of the month
, similar to what is available in Google CalendarPotential internship candidates
The text was updated successfully, but these errors were encountered: