@eeplatform/basic-edu 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +7 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4472,10 +4472,7 @@ import Joi11 from "joi";
|
|
|
4472
4472
|
// src/resources/program-screening/program.screening.service.ts
|
|
4473
4473
|
import { AppError as AppError8, useAtlas as useAtlas8 } from "@eeplatform/nodejs-utils";
|
|
4474
4474
|
function useProgramScreeningService() {
|
|
4475
|
-
const {
|
|
4476
|
-
updateStatusById: updateEnrollmentStatusById,
|
|
4477
|
-
getById: getEnrollmentById
|
|
4478
|
-
} = useEnrollmentRepo();
|
|
4475
|
+
const { updateStatusById: updateEnrollmentStatusById } = useEnrollmentRepo();
|
|
4479
4476
|
const { updateFieldById, getById: getProgramScreeningById } = useProgramScreeningRepo();
|
|
4480
4477
|
async function updateStatusById(id, status) {
|
|
4481
4478
|
const session = useAtlas8.getClient()?.startSession();
|
|
@@ -4485,20 +4482,21 @@ function useProgramScreeningService() {
|
|
|
4485
4482
|
if (!application) {
|
|
4486
4483
|
throw new AppError8("Application not found", 404);
|
|
4487
4484
|
}
|
|
4488
|
-
if (application.status !== "pending") {
|
|
4489
|
-
throw new AppError8("Only pending applications can be updated", 400);
|
|
4490
|
-
}
|
|
4491
4485
|
await updateFieldById(
|
|
4492
4486
|
{ _id: id, field: "status", value: status },
|
|
4493
4487
|
session
|
|
4494
4488
|
);
|
|
4495
4489
|
let enrollmentStatus = "pending";
|
|
4496
|
-
|
|
4490
|
+
const ReclassifyCond = status === "reclassified" && application.status && ["failed", "withdrawn"].includes(application.status);
|
|
4491
|
+
if (status === "passed" && application.status === "pending" || ReclassifyCond) {
|
|
4497
4492
|
enrollmentStatus = "pending";
|
|
4498
4493
|
}
|
|
4499
|
-
if (status === "failed") {
|
|
4494
|
+
if (status === "failed" && application.status === "pending") {
|
|
4500
4495
|
enrollmentStatus = "failed-screening";
|
|
4501
4496
|
}
|
|
4497
|
+
if (status === "withdrawn" && application.status === "pending") {
|
|
4498
|
+
enrollmentStatus = "withdrawn-screening";
|
|
4499
|
+
}
|
|
4502
4500
|
await updateEnrollmentStatusById(
|
|
4503
4501
|
application.applicant,
|
|
4504
4502
|
enrollmentStatus,
|