Fortlaufende Zyklus-Planung und Periodenlogik einführen
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user