diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-11-13 18:29:45 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-13 18:29:45 +0700 |
commit | f9057970bcd4c5692ab519a1ee4f0e153999b1c3 (patch) | |
tree | ecc6eef91d2efc770e0ead65156ec098d47e6543 /src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala | |
parent | 005b186725fac14b5361292456dd5025742b7646 (diff) | |
parent | 77b54e459d6478ae9685e8cac56ae21f08c263ef (diff) | |
download | rest-query-f9057970bcd4c5692ab519a1ee4f0e153999b1c3.tar.gz rest-query-f9057970bcd4c5692ab519a1ee4f0e153999b1c3.tar.bz2 rest-query-f9057970bcd4c5692ab519a1ee4f0e153999b1c3.zip |
Merge pull request #61 from drivergroup/PDSUI-2382
Fixed calculation of eligibility status with "Unknown" value
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala index 7027eef..193e8cb 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala @@ -19,17 +19,16 @@ object PatientCriterion { /** * @see https://driverinc.atlassian.net/wiki/display/MTCH/EV+Business+Process */ - def getEligibilityStatus(criterionValue: Option[Boolean], primaryValue: Option[LabelValue]): Option[LabelValue] = { + def getEligibilityStatus(criterionValue: Option[Boolean], primaryValue: LabelValue): LabelValue = { primaryValue match { - case None => None - case Some(LabelValue.Maybe) => Some(LabelValue.Maybe) - case Some(_) if criterionValue.isEmpty => Some(LabelValue.Maybe) - case Some(status) => - Some( + case LabelValue.Unknown => LabelValue.Unknown + case LabelValue.Maybe => LabelValue.Maybe + case _ if criterionValue.isEmpty => LabelValue.Maybe + case status => + LabelValue.fromBoolean( LabelValue.fromBoolean( - LabelValue.fromBoolean( - criterionValue.getOrElse(throw new IllegalArgumentException("Criterion should not be empty"))) == status - )) + criterionValue.getOrElse(throw new IllegalArgumentException("Criterion should not be empty"))) == status + ) } } @@ -48,13 +47,14 @@ final case class PatientCriterion(id: LongId[PatientCriterion], criterionText: String, criterionValue: Option[Boolean], criterionIsDefining: Boolean, - eligibilityStatus: Option[LabelValue], - verifiedEligibilityStatus: Option[LabelValue], + eligibilityStatus: LabelValue, + verifiedEligibilityStatus: LabelValue, isVerified: Boolean, isVisible: Boolean, lastUpdate: LocalDateTime, inclusion: Option[Boolean]) { - def isIneligibleForEv: Boolean = eligibilityStatus.contains(LabelValue.No) && isVerified + import scalaz.syntax.equal._ + def isIneligibleForEv: Boolean = eligibilityStatus === LabelValue.No && isVerified } object PatientCriterionArm { |