Skip to content

Commit

Permalink
maccalendar: save Notes in event struct (#17)
Browse files Browse the repository at this point in the history
Sync for real this time.
  • Loading branch information
shadyabhi committed Oct 21, 2023
1 parent b32c6cc commit 9ed20d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions calendar/gcal/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *Client) SyncCalendar(calEvents []calendar.Event) error {
log.Printf("Starting syncing all events, total_local_events: %d, total_gcal_events: %d", len(calEvents), len(eventsFromGoogle))

dupFinder := newDuplicateEventsFinder()
foundIndices := make([]int, 0)
foundIndicesCalEvents := make([]int, 0)
// Clean up stale events at Google Calendar
for _, event := range eventsFromGoogle {
// Events already created, skip them
Expand All @@ -43,7 +43,7 @@ func (c *Client) SyncCalendar(calEvents []calendar.Event) error {
event.Start.DateTime,
event.End.DateTime,
)
foundIndices = append(foundIndices, position)
foundIndicesCalEvents = append(foundIndicesCalEvents, position)
continue
}

Expand All @@ -62,7 +62,7 @@ func (c *Client) SyncCalendar(calEvents []calendar.Event) error {

// Create new events, as needed
for i, event := range calEvents {
if slices.Contains(foundIndices, i) {
if slices.Contains(foundIndicesCalEvents, i) {
// Event already exists, skip it
continue
}
Expand Down
2 changes: 2 additions & 0 deletions calendar/maccalendar/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ func getEvent(raw string) (calendar.Event, error) {
break
}
}
event.Notes = strings.TrimSuffix(notesBody, "\n")
}

// Time
timeLine := line[4 : len(line)-1]

Expand Down

0 comments on commit 9ed20d5

Please sign in to comment.