feat: T4 waves 1-2 - rule configs, schema, suggestions core, season, rule forms
- Rule configs with typed parsers and registry; Berlin day helpers - Schema: T4 enums, Suggestion table, feed vocabulary (feedStatus as ColonyCondition with legacy text mapping), split queen source, varroa sample size; migration harness for data migrations - SuggestionsService: propose/refresh/resolve/obsolete/expire, accept/dismiss/reopen incl. bulk, lock order, concurrency e2e - SeasonService: phenology-based segments, inspection/varroa due dates, queen age; TimeEventsStep with JobPartialFailure - Frontend: per-rule settings forms with visible value sources Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
7097fcd97c
commit
d99a697739
116 files changed
+11239
-801
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import type { SeasonSegmentKey } from '../../season/season-types';
|
||||
import { childScope, intIn, makeParser } from './parse-helpers';
|
||||
import type { InspectionIntervalConfig } from './rule-config.types';
|
||||
|
||||
type IntervalSegment = Exclude<SeasonSegmentKey, 'WINTERRUHE'>;
|
||||
|
||||
const MIN_INTERVAL_DAYS = 7;
|
||||
const MAX_INTERVAL_DAYS = 35;
|
||||
/** In the swarm season a colony is looked at weekly, at the latest every 9 days. */
|
||||
const MAX_SWARM_INTERVAL_DAYS = 9;
|
||||
|
||||
export const DEFAULT_INSPECTION_INTERVAL_CONFIG: InspectionIntervalConfig = {
|
||||
intervalDays: {
|
||||
FRUEHJAHR: 14,
|
||||
SCHWARMZEIT: 7,
|
||||
SOMMER: 14,
|
||||
SPAETSOMMER: 21,
|
||||
HERBST: 21,
|
||||
},
|
||||
};
|
||||
|
||||
const SEGMENTS = Object.keys(
|
||||
DEFAULT_INSPECTION_INTERVAL_CONFIG.intervalDays,
|
||||
) as IntervalSegment[];
|
||||
|
||||
export const inspectionIntervalParser = makeParser<InspectionIntervalConfig>(
|
||||
'INSPECTION_INTERVAL',
|
||||
DEFAULT_INSPECTION_INTERVAL_CONFIG,
|
||||
(scope) => {
|
||||
const days = childScope(scope, 'intervalDays');
|
||||
const defaults = DEFAULT_INSPECTION_INTERVAL_CONFIG.intervalDays;
|
||||
const intervalDays = { ...defaults };
|
||||
for (const segment of SEGMENTS) {
|
||||
intervalDays[segment] = intIn(
|
||||
days,
|
||||
segment,
|
||||
defaults[segment],
|
||||
MIN_INTERVAL_DAYS,
|
||||
segment === 'SCHWARMZEIT' ? MAX_SWARM_INTERVAL_DAYS : MAX_INTERVAL_DAYS,
|
||||
);
|
||||
}
|
||||
return { intervalDays };
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user