From 499c74c11e8cdd5d30d2aaf17727320b74c07707 Mon Sep 17 00:00:00 2001 From: Joy A Date: Mon, 24 Jun 2024 14:41:27 +0530 Subject: [PATCH] #1430 | Validate visit schedule rules using earliestDate instead of earliestVisitDateTime field --- packages/openchs-android/src/service/RuleEvaluationService.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/openchs-android/src/service/RuleEvaluationService.js b/packages/openchs-android/src/service/RuleEvaluationService.js index 3fb199ae2..d4ead055f 100644 --- a/packages/openchs-android/src/service/RuleEvaluationService.js +++ b/packages/openchs-android/src/service/RuleEvaluationService.js @@ -489,8 +489,8 @@ class RuleEvaluationService extends BaseService { } checkIfScheduledVisitsAreValid(nextVisits) { - if (nextVisits.map(visit => _.isNil(visit.earliestVisitDateTime)).length > 0) { - throw new Error("Visit(s) scheduled without earliestVisitDateTime"); + if (_.some(nextVisits, visit => _.isNil(visit.earliestDate))) { + throw new Error("Visit(s) scheduled without earliestDate"); } }