21 lines
970 B
TypeScript
21 lines
970 B
TypeScript
import type { ArtPointConfiguration } from './art-workflow-points'
|
|
import type { DingWorkflowDeliveryAssessment } from './ding-workflow-delivery'
|
|
|
|
/** Delivery exemptions apply to the whole workflow; point exemptions remain person/role specific. */
|
|
export function deliveryExemptWorkflowKeys(config: Pick<ArtPointConfiguration, 'overtimeExemptions'>) {
|
|
return new Set(config.overtimeExemptions
|
|
.filter(item => item.enabled !== false && item.workflowKey.trim())
|
|
.map(item => item.workflowKey.trim()))
|
|
}
|
|
|
|
export function applyDeliveryExemption(
|
|
assessment: DingWorkflowDeliveryAssessment,
|
|
workflowKey: string | null | undefined,
|
|
exemptKeys: ReadonlySet<string>,
|
|
): DingWorkflowDeliveryAssessment {
|
|
// Missing timing/standards must remain pending, even when a configuration exists.
|
|
return assessment.status === 'overtime' && exemptKeys.has(workflowKey?.trim() || '')
|
|
? { ...assessment, status: 'on_time', overtimeExempted: true }
|
|
: assessment
|
|
}
|