MCPcopy Create free account
hub / github.com/SolarLune/masterplan / ClockInPhase

Method ClockInPhase

contents.go:2171–2194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2169}
2170
2171func (tc *TimerContents) ClockInPhase() bool {
2172
2173 modeGroup := int(tc.Card.Properties.Get("mode group").AsFloat())
2174 if modeGroup != 2 {
2175 return false
2176 }
2177
2178 now := time.Now()
2179 todayStart := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
2180 scheduledTime := todayStart.Add(tc.ScheduleTime)
2181 inPhase := false
2182 if now.After(scheduledTime) {
2183 inPhase = true
2184 tc.Card.Stack.ForEachInTail(func(c *Card) bool {
2185 if clock, ok := c.Contents.(*TimerContents); ok && clock.ClockInPhase() {
2186 inPhase = false
2187 return false
2188 }
2189 return true
2190 })
2191 }
2192
2193 return inPhase
2194}
2195
2196func (tc *TimerContents) Trigger(triggerType int) {
2197

Callers 2

UpdateMethod · 0.95
DrawMethod · 0.95

Calls 4

AsFloatMethod · 0.80
ForEachInTailMethod · 0.80
GetMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected