Class tag support, add Adabelle
This commit is contained in:
15
class.go
15
class.go
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user