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

multiple rooms in notes #158

Open
slayernominee opened this issue Oct 10, 2023 · 5 comments
Open

multiple rooms in notes #158

slayernominee opened this issue Oct 10, 2023 · 5 comments

Comments

@slayernominee
Copy link

If there are multiple rooms show the other rooms in notes

@CommanderStorm
Copy link
Member

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

@slayernominee
Copy link
Author

EEE2EE47-A92D-4D4A-AC6A-4FB6D3E74F62_4_5005_c

they are not the same event but the same course in different rooms and they summarized version only shows the room of the first option

@slayernominee
Copy link
Author

image

so here is only one room in notes listed

@CommanderStorm
Copy link
Member

CommanderStorm commented Oct 12, 2023

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
}

@slayernominee
Copy link
Author

no no, the deduplication works completly fine, what i mean are the pink ones are the not filtered calendar entries but they have different rooms and they get summarized to one event (in orange) but in the orange entry there is only the note with the room location of one event and not all of them

so basically my idea is just to show all available rooms instead of only one

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

No branches or pull requests

2 participants