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

Duplicated Calendar Events Display #5296

Open
Bonapara opened this issue May 6, 2024 · 1 comment
Open

Duplicated Calendar Events Display #5296

Bonapara opened this issue May 6, 2024 · 1 comment
Labels
size: hours T type: bug Something isn't working

Comments

@Bonapara
Copy link
Member

Bonapara commented May 6, 2024

Current Behavior

Duplicate display of certain calendar events occurs, likely due to their presence in both my calendar and a team member's.

image

Desired Behavior

Merge the display of duplicate events.

@Bonapara Bonapara added type: bug Something isn't working size: hours labels May 6, 2024
Copy link

greptile-apps bot commented May 6, 2024

To resolve the issue of duplicated calendar events display, follow these steps:

  1. Modify getTimelineCalendarEventsForPeopleAndWorkspace Method: In /packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts, enhance the logic to check for duplicate events. After retrieving the calendar events and before returning them, implement a deduplication logic based on a unique attribute of the events (e.g., start time, end time, and title).

  2. Implement Deduplication Logic: Use the groupBy function from lodash to group events by their unique identifier. Then, for each group with more than one event, merge them into a single event. This could involve averaging the start and end times or simply picking one event to represent the group.

  3. Adjust CalendarEvent Repository: If the duplication is due to events being fetched separately for each person in a workspace, consider adjusting the queries in /packages/twenty-server/src/modules/calendar/repositories/calendar-event to filter out duplicates at the database level. This might involve using SQL's DISTINCT keyword or a similar mechanism to ensure that each event is unique across all users in a workspace.

These steps should help in merging the display of duplicate events, ensuring that each calendar event is displayed uniquely, regardless of how many users have it in their calendars.

References

twentyhq/twenty/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts
twentyhq/twenty/packages/twenty-server/src/modules/calendar/repositories/calendar-event

Ask Greptile

@FelixMalfait FelixMalfait added the T label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: hours T type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@FelixMalfait @Bonapara and others