Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1x 1x 1x 1x 1x 1x 1x 1x 142x 145x 145x 145x 145x 145x 3x 2x 1x | import {
PlanAgreementAssignmentErrorType,
PlanAgreementAssignmentStatus,
PlanAgreementStatus,
type PlanAgreement,
type PlanAgreementAssignment,
} from '@amalia/plan-agreements/types';
export const isPlanAgreementAssignmentRegenerable = (
planAgreement: Pick<PlanAgreement, 'status'>,
assignment: Pick<PlanAgreementAssignment, 'error' | 'sentDate' | 'status'>,
): boolean =>
// Agreement must be in error state or already finalized and not sent
(assignment.error?.type === PlanAgreementAssignmentErrorType.GENERATION_ERROR ||
(planAgreement.status === PlanAgreementStatus.FINALIZED && !assignment.sentDate)) &&
// Disable regeneration for agreements that are already in the process of being regenerated
assignment.status !== PlanAgreementAssignmentStatus.AGREEMENT_TO_GENERATE;
|