Fortlaufende Zyklus-Planung und Periodenlogik einführen

This commit is contained in:
Kai
2026-02-16 15:06:34 +01:00
parent 2255318993
commit 67bd87e12a
9 changed files with 138 additions and 63 deletions

View File

@@ -90,6 +90,20 @@ func monthOptions() []MonthOption {
return out
}
func cycleOffsetOptions(maxOffset int) []CycleOption {
if maxOffset < 0 {
maxOffset = 0
}
out := make([]CycleOption, 0, maxOffset+1)
for i := 0; i <= maxOffset; i++ {
out = append(out, CycleOption{
Value: i,
Label: fmt.Sprintf("+%d Zyklus", i),
})
}
return out
}
func monthInWindow(month, start, end int) bool {
if start <= end {
return month >= start && month <= end
@@ -105,6 +119,14 @@ func wrapMonth(v int) int {
return m
}
func periodMonth(period int) int {
return (period % 12) + 1
}
func periodCycle(period int) int {
return period / 12
}
func validateCropInput(name string, start, end, grow, regrowCycles int) error {
if name == "" {
return errors.New("Name der Feldfrucht fehlt")