More algowhizbang that now almost matches manual calc
This commit is contained in:
parent
355e07cf53
commit
34d8e2dafb
@ -137,7 +137,7 @@ func main() {
|
|||||||
evt.Location = loc
|
evt.Location = loc
|
||||||
|
|
||||||
if evt.Start == evt.End {
|
if evt.Start == evt.End {
|
||||||
log.Printf("skipping same-day event on %s", evt.Start)
|
log.Printf("skipping same-day event on %s (%s)", evt.Start, evt.Summary)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
foundEvents = append(foundEvents, evt)
|
foundEvents = append(foundEvents, evt)
|
||||||
@ -151,6 +151,7 @@ func main() {
|
|||||||
for _, evt := range foundEvents {
|
for _, evt := range foundEvents {
|
||||||
log.Printf("checking if %s is in range %s %s", day.Date, evt.Start, evt.End)
|
log.Printf("checking if %s is in range %s %s", day.Date, evt.Start, evt.End)
|
||||||
if evt.HasDate(day.Date) {
|
if evt.HasDate(day.Date) {
|
||||||
|
log.Printf("match found for %s in range %s %s, setting location to %s", day.Date, evt.Start, evt.End, evt.Location)
|
||||||
day.Location = evt.Location
|
day.Location = evt.Location
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,8 +237,8 @@ type lilEvent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *lilEvent) HasDate(d string) bool {
|
func (e *lilEvent) HasDate(d string) bool {
|
||||||
if e.Start == d || e.End == d {
|
if e.Start == d {
|
||||||
log.Printf("match for %s in %s or %s", d, e.Start, e.End)
|
log.Printf("match for %s at %s", d, e.Start)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,12 +274,7 @@ type lilDay struct {
|
|||||||
|
|
||||||
func generateDays(startT, endT time.Time) []*lilDay {
|
func generateDays(startT, endT time.Time) []*lilDay {
|
||||||
defaultLocation := *defaultLocationFlag
|
defaultLocation := *defaultLocationFlag
|
||||||
days := []*lilDay{
|
days := []*lilDay{}
|
||||||
{
|
|
||||||
Date: startT.Format(dateFmt),
|
|
||||||
Location: defaultLocation,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
curT := startT
|
curT := startT
|
||||||
for {
|
for {
|
||||||
|
Loading…
Reference in New Issue
Block a user