diff --git a/lib/performance-survey-service.ts b/lib/performance-survey-service.ts index c8dc7c1a..bbc9e342 100644 --- a/lib/performance-survey-service.ts +++ b/lib/performance-survey-service.ts @@ -639,6 +639,19 @@ export async function listPerformanceSurveys(session: Session | null) { }, }) + const submittedAssignments = await prisma.performanceSurveyAssignment.findMany({ + where: { + evaluatorKey: ctx.evaluatorKey, + status: 'submitted', + }, + include: { + survey: true, + target: true, + }, + orderBy: { submittedAt: 'desc' }, + take: 100, + }) + const managerWhere = ctx.isDepartmentAdmin ? ctx.isSystemAdmin ? {} @@ -713,6 +726,18 @@ export async function listPerformanceSurveys(session: Session | null) { templateCode: assignment.survey.templateCode, submittedAt: assignment.submittedAt, })), + submitted: submittedAssignments.map((assignment) => ({ + assignmentId: assignment.id, + surveyId: assignment.surveyId, + targetId: assignment.targetId, + title: assignment.survey.title, + status: assignment.status, + surveyStatus: assignment.survey.status, + dueAt: assignment.survey.dueAt, + targetName: assignment.target.targetName, + templateCode: assignment.survey.templateCode, + submittedAt: assignment.submittedAt, + })), created: createdSurveys.map((survey) => ({ id: survey.id, title: survey.title,