fix(planner): remove unused import, fix urgency/cascade type casts, fix overflow invalid dates
This commit is contained in:
parent
333f0e5316
commit
fd4269949f
@ -118,8 +118,17 @@ export function planDay(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!placed) {
|
if (!placed) {
|
||||||
// Overflow — doesn't fit
|
// Overflow — doesn't fit; no time slot assigned
|
||||||
overflow.push(toProposed(act, 0, act.durationMinutes * 60_000));
|
overflow.push({
|
||||||
|
label: act.label,
|
||||||
|
startTime: '',
|
||||||
|
endTime: '',
|
||||||
|
durationMinutes: act.durationMinutes,
|
||||||
|
priority: act.priority ?? 'medium',
|
||||||
|
urgency: act.urgency ?? priorityToUrgency(act.priority ?? 'medium'),
|
||||||
|
category: act.category,
|
||||||
|
cascade: urgencyToCascade(act.urgency ?? priorityToUrgency(act.priority ?? 'medium')),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,8 +156,8 @@ function toProposed(act: Activity & { earliestStart?: number }, startMs: number,
|
|||||||
const urgency = act.urgency ?? priorityToUrgency(act.priority ?? 'medium');
|
const urgency = act.urgency ?? priorityToUrgency(act.priority ?? 'medium');
|
||||||
return {
|
return {
|
||||||
label: act.label,
|
label: act.label,
|
||||||
startTime: startMs > 0 ? new Date(startMs).toISOString() : '',
|
startTime: new Date(startMs).toISOString(),
|
||||||
endTime: endMs > 0 && startMs > 0 ? new Date(endMs).toISOString() : '',
|
endTime: new Date(endMs).toISOString(),
|
||||||
durationMinutes: act.durationMinutes,
|
durationMinutes: act.durationMinutes,
|
||||||
priority: act.priority ?? 'medium',
|
priority: act.priority ?? 'medium',
|
||||||
urgency,
|
urgency,
|
||||||
|
|||||||
@ -11,10 +11,11 @@ import { extractAuth } from '../../lib/auth.js';
|
|||||||
import { isFeatureEnabled } from '../../lib/feature-flags.js';
|
import { isFeatureEnabled } from '../../lib/feature-flags.js';
|
||||||
import { PRODUCT_ID } from '../../lib/product-config.js';
|
import { PRODUCT_ID } from '../../lib/product-config.js';
|
||||||
import { trackEvent } from '../../lib/telemetry.js';
|
import { trackEvent } from '../../lib/telemetry.js';
|
||||||
import { PLANNER_DAY_PLANNED, PLANNER_PLAN_APPLIED, PLANNER_PLAN_REJECTED } from '../../lib/telemetry-events.js';
|
import { PLANNER_DAY_PLANNED, PLANNER_PLAN_APPLIED } from '../../lib/telemetry-events.js';
|
||||||
import { planDay } from './engine.js';
|
import { planDay } from './engine.js';
|
||||||
import { PlanDayRequestSchema, ApplyPlanRequestSchema } from './types.js';
|
import { PlanDayRequestSchema, ApplyPlanRequestSchema } from './types.js';
|
||||||
import * as timerRepo from '../timers/repository.js';
|
import * as timerRepo from '../timers/repository.js';
|
||||||
|
import type { UrgencyLevel, CascadePreset } from '../timers/types.js';
|
||||||
import { randomUUID } from 'node:crypto';
|
import { randomUUID } from 'node:crypto';
|
||||||
|
|
||||||
export async function plannerRoutes(app: FastifyInstance) {
|
export async function plannerRoutes(app: FastifyInstance) {
|
||||||
@ -78,12 +79,12 @@ export async function plannerRoutes(app: FastifyInstance) {
|
|||||||
label: p.label,
|
label: p.label,
|
||||||
type: 'countdown',
|
type: 'countdown',
|
||||||
state: 'active',
|
state: 'active',
|
||||||
urgency: (p.urgency as 'standard') || 'standard',
|
urgency: (p.urgency || 'standard') as UrgencyLevel,
|
||||||
duration: endMs - startMs,
|
duration: endMs - startMs,
|
||||||
targetTime: p.endTime,
|
targetTime: p.endTime,
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
startedAt: p.startTime,
|
startedAt: p.startTime,
|
||||||
cascade: { preset: p.cascade as 'standard', intervals: [] },
|
cascade: { preset: (p.cascade || 'standard') as CascadePreset, intervals: [] },
|
||||||
category: p.category,
|
category: p.category,
|
||||||
syncVersion: 1,
|
syncVersion: 1,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user