Class tag support, add Adabelle

This commit is contained in:
Ian Gulliver
2020-09-13 21:27:40 +00:00
parent 7f939b677d
commit 65b2975b24
4 changed files with 139 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"log"
"time"
"google.golang.org/api/calendar/v3"
@@ -13,6 +14,7 @@ type Class struct {
End string
Students []string
Days []time.Weekday
Tags map[string]string
Zoom string
}
@@ -25,6 +27,19 @@ func (c Class) happensOnDay(t time.Time) bool {
return false
}
func (c Class) tagsMatch(t time.Time) bool {
for key, value := range c.Tags {
tagValue, err := getTagAt(key, t)
if err != nil {
log.Fatal(err)
}
if value != tagValue {
return false
}
}
return true
}
func (c Class) buildEvent(t time.Time) *calendar.Event {
dateStr := t.Format("2006-01-02")