-
Notifications
You must be signed in to change notification settings - Fork 0
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
Introduce a function for date range events #5
Conversation
pkg/calendar/calendar.go
Outdated
for d := start; !d.After(end); d = d.AddDate(0, 0, 1) { | ||
dailyEvents, err := cal.GetEventsOnDay(d) | ||
if err != nil { | ||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather just skip the day then if there is an error for a specific day. I'd just continue
if there is an error and maybe log it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusted.
pkg/calendar/calendar.go
Outdated
@@ -42,7 +42,21 @@ func (cal *Calendar) SetTimezone(tz *time.Location) { | |||
cal.tz = tz | |||
} | |||
|
|||
func (cal Calendar) GetEventsOn(date time.Time) ([]ical.Event, error) { | |||
func (cal Calendar) GetEventsOfRange(start time.Time, end time.Time) ([]ical.Event, error) { | |||
var allEvents []ical.Event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider initializing this variable for the reasons I mentioned in #6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no nil
return anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to have some tests even if they are based on the exisiting small set of test data.
No description provided.