diff --git a/src/service/unit/inspection/inspectionPlanService.ts b/src/service/unit/inspection/inspectionPlanService.ts index f422798..0ee2e89 100644 --- a/src/service/unit/inspection/inspectionPlanService.ts +++ b/src/service/unit/inspection/inspectionPlanService.ts @@ -12,7 +12,7 @@ export default abstract class InspectionPlanService { "inspectionPlan.latestVersionedPlan", "inspectionPlan.versionedPlans", "latestVersionedPlan", - 'latestVersionedPlan.inspectionPlanId = inspectionPlan.id AND latestVersionedPlan.version = (SELECT MAX("ivp"."createdAt") FROM "inspection_versioned_plan" "ivp" WHERE "ivp"."inspectionPlanId" = "inspectionPlan"."id")' + 'latestVersionedPlan.inspectionPlanId = inspectionPlan.id AND latestVersionedPlan.version = (SELECT MAX("ivp"."version") FROM "inspection_versioned_plan" "ivp" WHERE "ivp"."inspectionPlanId" = "inspectionPlan"."id")' ) .leftJoinAndSelect("latestVersionedPlan.inspectionPoints", "inspectionPoints") .leftJoinAndSelect("inspectionPlan.equipmentType", "equipmentType")