only send not completed jobs
This commit is contained in:
@@ -7,6 +7,10 @@ import { sendEmailFromTemplate } from '~/lib/services/mailer.service';
|
|||||||
export default async function sendOpenJobsEmails() {
|
export default async function sendOpenJobsEmails() {
|
||||||
const analysisResponseIds = await getOpenJobAnalysisResponseIds();
|
const analysisResponseIds = await getOpenJobAnalysisResponseIds();
|
||||||
|
|
||||||
|
if (analysisResponseIds.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const doctorAccounts = await getDoctorAccounts();
|
const doctorAccounts = await getDoctorAccounts();
|
||||||
const doctorEmails: string[] = doctorAccounts
|
const doctorEmails: string[] = doctorAccounts
|
||||||
.map(({ email }) => email)
|
.map(({ email }) => email)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ async function getAssignedOrderIds() {
|
|||||||
.schema('medreport')
|
.schema('medreport')
|
||||||
.from('doctor_analysis_feedback')
|
.from('doctor_analysis_feedback')
|
||||||
.select('analysis_order_id')
|
.select('analysis_order_id')
|
||||||
|
.not('status', 'is', 'COMPLETED')
|
||||||
.not('doctor_user_id', 'is', null)
|
.not('doctor_user_id', 'is', null)
|
||||||
.throwOnError();
|
.throwOnError();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user