only send not completed jobs

This commit is contained in:
Danel Kungla
2025-10-10 14:42:41 +03:00
parent cf147919a6
commit e84541339d
2 changed files with 5 additions and 0 deletions

View File

@@ -7,6 +7,10 @@ import { sendEmailFromTemplate } from '~/lib/services/mailer.service';
export default async function sendOpenJobsEmails() {
const analysisResponseIds = await getOpenJobAnalysisResponseIds();
if (analysisResponseIds.length === 0) {
return;
}
const doctorAccounts = await getDoctorAccounts();
const doctorEmails: string[] = doctorAccounts
.map(({ email }) => email)

View File

@@ -7,6 +7,7 @@ async function getAssignedOrderIds() {
.schema('medreport')
.from('doctor_analysis_feedback')
.select('analysis_order_id')
.not('status', 'is', 'COMPLETED')
.not('doctor_user_id', 'is', null)
.throwOnError();