message:`Technical evaluation for ${evaluation.user?.firstName||'contractor'}(${evaluation.month}/${evaluation.year}) has been submitted. Professional evaluation pending.`,
actionUrl:`/admin/evaluations`,
entityType:'evaluation',
entityId:evaluationId,
});
} catch { /* non-critical */ }
}
return updated;
}
async submitProfessional(
evaluationId: string,
dto: SubmitProfessionalEvalDto,
currentUser: RequestUser,
): Promise<any> {
if (currentUser.role !== 'SUPER_ADMIN' && currentUser.role !== 'ADMIN') {
throw new ForbiddenException('Only Super Admin and Admin can submit professional evaluations');
createdById:userId,// System-created, attributed to contractor
title:`Learn: ${rating.competencyArea.name}`,
description:`Self-assessment identified this as a learning gap (rated ${rating.level}/5). Per contract: "Any skill you don't yet have, you agree to acquire within 45 days."`,
competencyAreaId:rating.competencyAreaId,
deadline,
originalDeadline:deadline,
assessmentMethod:'PL_ASSESSMENT',
passFailCriteria:`Demonstrate competency level 3 or above in ${rating.competencyArea.name} as assessed by your Project Leader.`,
source:'SELF_ASSESSMENT_GAP',
status:'ACTIVE',
},
});
created++;
}
if(created>0){
this.logger.log(`${created} learning goals auto-created from self-assessment gaps for user ${userId}`);
message:`A ${dto.duration}-day Performance Improvement Plan has been issued. Start: ${startDate.toISOString().split('T')[0]}. End: ${endDate.toISOString().split('T')[0]}. Please review all details carefully.`,
actionUrl:`/evaluations`,
isBlocking:true,
entityType:'pip',
entityId:pip.id,
});
}catch(err){
this.logger.warn(`Failed to send PIP notification: ${err.message}`);
}
this.logger.log(
`PIP created for ${contractor.firstName}${contractor.lastName}: ${dto.duration} days, by ${currentUser.email}`,