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

Support of recurring events #38

Closed
donni106 opened this issue Jun 27, 2022 · 37 comments · Fixed by #49
Closed

Support of recurring events #38

donni106 opened this issue Jun 27, 2022 · 37 comments · Fixed by #49
Assignees
Labels
api Issues to update existing endpoints or to add new ones calendar Adjustments of the HumHub calendar entries
Milestone

Comments

@donni106
Copy link
Member

Recurrence of events is already implemented for the calendar and can be used in the web application: https://github.com/humhub/calendar
There is a form where users can select several options:

recurrence or not daily weekly monthly monthly end yearly
Bildschirmfoto 2022-06-27 um 15 37 45 Bildschirmfoto 2022-06-27 um 15 38 01 Bildschirmfoto 2022-06-27 um 15 38 09 Bildschirmfoto 2022-06-27 um 15 38 25 Bildschirmfoto 2022-06-27 um 15 38 38 Bildschirmfoto 2022-06-27 um 15 38 48

For the API it is missing in the default rest module. There was an issue opened in February 2021, which was never addressed: humhub/rest#50

Can we extend the functionality with our extension and implement the missing pieces for creating recurring events?

@donni106 donni106 added api Issues to update existing endpoints or to add new ones calendar Adjustments of the HumHub calendar entries labels Jun 27, 2022
@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
Okay, we will create a new endpoint for creating calendar entry like /calendar/container/containerId:\d+.

ContainerId = it is user id that we will pass
Thanks!

@donni106 donni106 added this to the 0.5 milestone Jul 5, 2022
@gaurav-handysolver
Copy link
Collaborator

gaurav-handysolver commented Jul 6, 2022

Hi @donni106
I have a question to ask
Do you need to show details of recurrence in API response? because recurrence information stored in very complicated way in database like this.

image

So, it is difficult to convert this data into human readable format.

@donni106
Copy link
Member Author

donni106 commented Jul 6, 2022

Do you need to show details of recurrence in API response?

I don't think so. Do you have an example response that will be possible? So I can say if that is enough for our use cases.

@gaurav-handysolver
Copy link
Collaborator

gaurav-handysolver commented Jul 6, 2022

Hi @donni106
Okay, so here is the response which we getting while creating calendar entry.

image

image

We can show recurring_event details like this:

image

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
We are waiting for you reply for this point
Thanks!

@donni106
Copy link
Member Author

I did not have the time to check that yet, sorry.

@gaurav-handysolver
Copy link
Collaborator

No problem!

@donni106
Copy link
Member Author

Can you please explain more in detail. I am not sure what happens when.

  1. What will users be able to call with which parameters to create recurring events?
  2. What will users be able to call to receive events that are recurring? How does responses look like?
  3. Is an event that happens three times also three times in the results of requesting all events or is it included once with additional infos that makes it able to present three times?

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
Ans 1. We need the following parameter to create recurring event

  1. frequency = it is represent what type of repeat event you will choose (never=>-1, year => 0, month => 1, week => 2, day => 3).

  2. interval = it is represent the difference between current and next event . it is accepted interger value .

  3. weekDays = it is represent week days, when you select week => 2 value in frequency (sunday => 1, monday => 2 and so on).

  4. monthDaySelection = it is represent day of month that recurrence event happen like (Monthly on day 15 => 1, Monthly on the third Friday => 2). it is required when you select month in frequency .

  5. end = it is represent when you end this recurrence event (never => 0, onDate = > 1, After (occurrences )=> 2 )

  6. endDate = it is represent end date when you end this recurrence event, it is required when you select (onDate => 1).

  7. endOccurrences = it is represent number of times this event will be happen like we want activate this event next 5 day so, we insert 5 in this parameter as value.

image

Ans 2. After creating the recurring event, the user will get response like (FREQ=DAILY;COUNT=5;INTERVAL=1).
frequency = daily, count(endOccurence) = 5 and interval = 1

Ans 3. When we create an event and that event we want recurring event then in that case we only mentioned how many times we want to repeat this event with the help of 'endOcurrence' parameter. we don't need additional information that makes it ables to present three times.

Thanks!

@donni106
Copy link
Member Author

Ans 1. We need the following parameter to create recurring event

image

is this the object that needs to be passend when creating an event?

Ans 2. After creating the recurring event, the user will get response like (FREQ=DAILY;COUNT=5;INTERVAL=1). frequency = daily, count(endOccurence) = 5 and interval = 1
Ans 3. When we create an event and that event we want recurring event then in that case we only mentioned how many times we want to repeat this event with the help of 'endOcurrence' parameter. we don't need additional information that makes it ables to present three times.

my question is, how are the events returned by the api? example: if i want to show events in a calendar and i have an event every tuesday of a month. i would like to mark every tuesday of a month for the user. so in a month with 4 tuesdays there should exist four events, right? when querying the endpoint for all events, will there be four events? or will there be one event? if there will be just one event, how do i know, that i need to mark 4 tuesdays in a month?
any questions on that or did you understand my problem?

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
Yes we understand your problem and we checked the api that fetching all calendar events (/calendar) and there is no information present related to recurring event so, when we fetching event which is recurring then it is not showing any recurrence information.

For example : id = 26

image

And we fetching the result it looks like

image

furthere more

image

image

I Hope it will clear your problem
Thanks!

@donni106
Copy link
Member Author

We knew, that there are no information about recurring events currently in the calendar API, that was why we created the issue for you :)

How would the result look like after your solution? What is the RecurrenceFormModel? Is this passed as param to the API on creation or a new part in the result when fetching calendar data?

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106

The result is looking like this

image

RecurrenceFormModel is the model which is responsible for saving recurring events.

image

Sending Recurring data in payload

image

@donni106
Copy link
Member Author

so there is one calendar entry returned with addition Reccurring_event info and not multiple calendar entries, right?
in your example there is freq=weekly, count=10, interval=1, byday=we. without checking the documentation, can you tell me with an example, how much events this would be? from today 10 weeks on every wednesday?

how can we display multiple events this way? can you imagine some implementation to format/translate reccurring infos to return multiple calendar entries instead of one entry with the information? so that the API returns 10 entries on every wednesday in the selected reccurring time span?

@gaurav-handysolver
Copy link
Collaborator

so there is one calendar entry returned with addition Reccurring_event info and not multiple calendar entries, right?

Hi @donni106
Yes, multiple calendar entries not returned

in your example there is freq=weekly, count=10, interval=1, byday=we. without checking the documentation, can you tell me with an example, how much events this would be? from today 10 weeks on every wednesday?

Yes, from today to next 10 weeks on every wednesday (see the screenshot attached below)

image

how can we display multiple events this way? can you imagine some implementation to format/translate reccurring infos to return multiple calendar entries instead of one entry with the information? so that the API returns 10 entries on every wednesday in the selected reccurring time span?

Yes we can show all recurring events as separate entry like all 10 weeks wednesday but there is one condition you have to pass start date and end date for fetching both single event and recurring events in that particular date range.

For example : You wants all calendar entries between 10-07-2022 and 30-07-2022 then if three recurring events lies in between this date range then they will be shown as separate entry.

image

Why we need start date and end date?
Because there is a option "end" in recurring section which tell when this recurring event will be ended and this option also accepted "never" value. So, if we not take dates and event is infinite then entries will be never end.

image

@donni106
Copy link
Member Author

donni106 commented Jul 22, 2022

Ok I think we now have a common understanding about the complexity.
Please implement the solution that will return multiple events according to the recurrence form model.
Considering your screenshots, this would correspond to:

  1. json returning calendar entries on every Wednesday

and

  1. json returning three calendar entries on Wednesdays 13.07., 20.07. and 27.07. because of start and end date

right?

@gaurav-handysolver
Copy link
Collaborator

Please implement the solution that will return multiple events according to the recurrence form model.

Okay, we will implement that

  1. json returning three calendar entries on Wednesdays 13.07., 20.07. and 27.07. because of start and end date

right?

Yes

@gaurav-handysolver
Copy link
Collaborator

gaurav-handysolver commented Jul 27, 2022

Hi @donni106
Should we create a new endpoint showing a list of recurring events in a specific date range?
Example : /calendar/entries

@donni106
Copy link
Member Author

When we check calendar data, recurrence should be part of it. I guess it would be very hard to ask for recurrence separately. Requesting events in all available kinds should contain recurrence, if exists. When one asks for events, it is expected to receive all the events no matter if they are one time events or recurring events, right?

  • /calendar/entry/{id}
  • /calendar/container/{id}
  • /calendar

Did I miss some endpoint?

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
Yes, we can use or implement recurring events details in the above endpoints you mentioned but for recurring events, we have to pass additional starting and ending dates (specific date range).

If we do not provide any dates then we have to think of other approaches as well for recurring events

What are your thoughts?

@donni106
Copy link
Member Author

We will have calendar views, so requests could have monthly ranges. On the other hand we will have requests for events from today up to the future, so we can have a range from today to 31.12.2100 or something if we really need an end date.
I cannot think of any case were we are not able to set a range.

@gaurav-handysolver
Copy link
Collaborator

Okay @donni106
So, we will modify the above endpoints (you mentioned) so, that recurrence events will be shown, if available right?

@donni106
Copy link
Member Author

Yes please 🤝

@Gk29-dev
Copy link

Gk29-dev commented Aug 1, 2022

Hi @donni106
Can you tell us which data you want to see in recurring events?

image
Thanks!

@donni106
Copy link
Member Author

donni106 commented Aug 1, 2022

Is it ok to say: the same as for not recurring events? I guess every event should provide the same data? Or what exactly is the question?

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
The last comment by mistake was sent through my personal GitHub account so, please don't mention that username for further conversation

@gaurav-handysolver
Copy link
Collaborator

Is it ok to say: the same as for not recurring events? I guess every event should provide the same data? Or what exactly is the question?

Actually, recurring events return some additional data like backgroundColor, view mode, etc. So, we are asking what data should be returned from recurring events.

@donni106
Copy link
Member Author

donni106 commented Aug 1, 2022

Actually, recurring events return some additional data like backgroundColor, view mode, etc. So, we are asking what data should be returned from recurring events.

all right, so I would say that we do not need to exclude anything, let's return everything available?

@gaurav-handysolver
Copy link
Collaborator

Okay @donni106

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
We are facing a problem while fetching the recurring events. when we are fetching events without bearer token, the recurring events not getting but when we add bearer token/BaseContentController class then it is running fine.

So, if we add BaseContentController class in our CalendarController then issue #6 will be invalid, and if we will not add that class then recurring events not fetching.

We still can't find why this is happening

What we should do now? Will we create new endpoints

@donni106
Copy link
Member Author

donni106 commented Aug 4, 2022

What about having a new controller and a new endpoint especially for recurring calendar events and keep the current calendar events untouched? this way it should be still possible to fetch calendar events without bearer token, right?
and if we want to show all calendar events we need to fetch the regular calendar events and the recurring calendar events in addition. this would result in always fetching two endpoints for calendar events, with or without bearer token.
could this be a solution?

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
Yes, this will be the solution. we will create a new controller and new endpoint for the recurring events so, if you want to fetch recurring events then pass the bearer token and you will get all the recurring events in that date range

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
One question: what will be the name of the new recurring endpoint?

@donni106
Copy link
Member Author

donni106 commented Aug 4, 2022

All right, let's do:

GET /calendar/recurring
GET /calendar/container/{containerId}/recurring

Will there be an endpoint to get one recurring event like GET /calendar/entry/{id}? Do these recurring events have IDs?

@gaurav-handysolver
Copy link
Collaborator

Hi @donni106
We have a doubt: do you want only recurring events will be shown in these endpoints?
For example :
There are three events, 2 events are recurring and one is not so, the non-recurring event will be shown or not in that date range?

@donni106
Copy link
Member Author

donni106 commented Aug 5, 2022

If the non recurring event would be returned by /calendar it should not be returned with /calendar/recurring. Does this answer the question?

@gaurav-handysolver
Copy link
Collaborator

Yes @donni106
Thanks!

gaurav-handysolver added a commit that referenced this issue Aug 5, 2022
Now, you will get all the recurring events in a given date of range.

Note: You have to pass bearer token, start_date and end_date for getting recurring events.
@donni106 donni106 linked a pull request Aug 8, 2022 that will close this issue
donni106 pushed a commit that referenced this issue Aug 10, 2022
Now, you will get all the recurring events in a given date of range.

Note: You have to pass bearer token, start_date and end_date for getting recurring events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues to update existing endpoints or to add new ones calendar Adjustments of the HumHub calendar entries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants