No default students
This commit is contained in:
11
class.go
11
class.go
@@ -40,7 +40,7 @@ func (c Class) tagsMatch(t time.Time) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (c Class) buildEvent(t time.Time) *calendar.Event {
|
||||
func (c Class) buildEvent(t time.Time) (*calendar.Event, error) {
|
||||
dateStr := t.Format("2006-01-02")
|
||||
|
||||
ev := &calendar.Event{
|
||||
@@ -56,12 +56,11 @@ func (c Class) buildEvent(t time.Time) *calendar.Event {
|
||||
Attendees: []*calendar.EventAttendee{},
|
||||
}
|
||||
|
||||
attendees := c.Students
|
||||
if len(attendees) == 0 {
|
||||
attendees = allStudents
|
||||
if len(c.Students) == 0 {
|
||||
return nil, fmt.Errorf("class with no students: %s", c.Summary)
|
||||
}
|
||||
|
||||
for _, student := range attendees {
|
||||
for _, student := range c.Students {
|
||||
ev.Attendees = append(
|
||||
ev.Attendees,
|
||||
&calendar.EventAttendee{
|
||||
@@ -74,5 +73,5 @@ func (c Class) buildEvent(t time.Time) *calendar.Event {
|
||||
ev.Description = fmt.Sprintf(`Zoom: %s`, c.Zoom)
|
||||
}
|
||||
|
||||
return ev
|
||||
return ev, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user