Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

When duplicate calendar entries exist for the same lecture (same summary + start time) but with different room locations, the deduplication was discarding the additional room information entirely.

Changes

  • First pass collection: Collect all locations per dedup key before processing
  • Preserve additional rooms: Pass non-duplicate locations to cleanEvent and prepend them to the description
  • Dedup handling: Use a map to prevent duplicate room names from appearing

Output format

When events are deduplicated with different locations, the description now includes:

Additional rooms:
MI HS 1

https://nav.tum.de/room/5508.02.801
MW 1801, Ernst-Schmidt-Hörsaal (5508.02.801)
...
Original prompt

This section details on the original issue you should resolve

<issue_title>multiple rooms in notes</issue_title>
<issue_description>If there are multiple rooms show the other rooms in notes </issue_description>

Comments on the Issue (you are @copilot in this section)

@CommanderStorm Could you provide a screenshot of what event you are refering to? Calendar entrys in TUMonline natively only have one room as far as I have seen @CommanderStorm Could you share the source ical of just these events which we are not deduplicating?

Note that we already have deduplication (=> maybe this is not working perfectly?):

func TestDeduplication(t *testing.T) {
testData, app := getTestData(t, "duplication.ics")
calendar, err := app.getCleanedCalendar([]byte(testData))
if err != nil {
t.Error(err)
return
}
if len(calendar.Components) != 1 {
t.Errorf("Calendar should have only 1 entry after deduplication but has %d", len(calendar.Components))
return
}
}

This is the function that does the deduplication (PR welome, if you want to give this a try ^^):

func (a *App) getCleanedCalendar(all []byte) (*ics.Calendar, error) {
cal, err := ics.ParseCalendar(strings.NewReader(string(all)))
if err != nil {
return nil, err
}
// Create map that tracks if we have allready seen a lecture name & datetime (e.g. "lecturexyz-1.2.2024 10:00" -> true)
hasLecture := make(map[string]bool)
var newComponents []ics.Component // saves the components we keep because they are not duplicated
for _, component := range cal.Components {
switch component.(type) {
case *ics.VEvent:
event := component.(*ics.VEvent)
dedupKey := fmt.Sprintf("%s-%s", event.GetProperty(ics.ComponentPropertySummary).Value, event.GetProperty(ics.ComponentPropertyDtStart))
if _, ok := hasLecture[dedupKey]; ok {
continue
}
hasLecture[dedupKey] = true // mark event as seen
a.cleanEvent(event)
newComponents = append(newComponents, event)
default: // keep everything that is not an event (metadata etc.)
newComponents = append(newComponents, component)
}
}
cal.Components = newComponents
return cal, nil
}
</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 5, 2025 20:44
When the same lecture has multiple duplicate calendar entries with
different room locations (same summary and start time), the deduplication
now preserves the additional room information by including them in the
event's description/notes field.

The format is:
Additional rooms:
<room1>
<room2>

<original description>

Co-authored-by: kordianbruck <[email protected]>
Use a map to track seen locations and prevent duplicates from appearing
in the additional rooms section of the description.

Co-authored-by: kordianbruck <[email protected]>
Copilot AI changed the title [WIP] Add support for multiple rooms in notes feat: show additional rooms in notes when deduplicating calendar events Dec 5, 2025
Copilot AI requested a review from kordianbruck December 5, 2025 20:47
@kordianbruck kordianbruck marked this pull request as ready for review December 5, 2025 20:56
@kordianbruck kordianbruck merged commit 5f12431 into master Dec 5, 2025
1 check passed
@kordianbruck kordianbruck deleted the copilot/add-multiple-rooms-to-notes branch December 5, 2025 21:04
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

Successfully merging this pull request may close these issues.

multiple rooms in notes

2 participants