diff options
author | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-03 13:08:00 -0700 |
---|---|---|
committer | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-03 13:08:00 -0700 |
commit | 0653b90dddc294fddb0e81059aef00b202113d78 (patch) | |
tree | 3d8abb424b0f0495f1cbb18849184dd20d6897fc /src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala | |
parent | 5750f2f3633e75f2f96d6a36264ab4b8f3fec7d2 (diff) | |
parent | a321a978353439fc516b0f2016c28fb32ba1b7ae (diff) | |
download | rest-query-0653b90dddc294fddb0e81059aef00b202113d78.tar.gz rest-query-0653b90dddc294fddb0e81059aef00b202113d78.tar.bz2 rest-query-0653b90dddc294fddb0e81059aef00b202113d78.zip |
Merge branch 'master' into add-slot-eligibility-arms
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala index b34f339..239adb1 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala @@ -14,7 +14,8 @@ final case class ApiCriterion(id: Long, text: Option[String], isCompound: Boolean, labels: Seq[ApiCriterionLabel], - trialId: String) { + trialId: String, + inclusion: Option[Boolean]) { def toDomain = RichCriterion( criterion = Criterion( @@ -22,7 +23,8 @@ final case class ApiCriterion(id: Long, trialId = StringId[Trial](trialId), text, isCompound, - meta.getOrElse("") + meta.getOrElse(""), + inclusion ), armIds = arms.map(LongId[EligibilityArm]), labels = labels.map(_.toDomain(LongId[Criterion](id))) @@ -40,7 +42,8 @@ object ApiCriterion { (JsPath \ "text").formatNullable[String] and (JsPath \ "isCompound").format[Boolean] and (JsPath \ "labels").format(seqJsonFormat[ApiCriterionLabel]) and - (JsPath \ "trialId").format[String] + (JsPath \ "trialId").format[String] and + (JsPath \ "inclusion").formatNullable[Boolean] )(ApiCriterion.apply, unlift(ApiCriterion.unapply)) def fromDomain(richCriterion: RichCriterion) = ApiCriterion( @@ -50,6 +53,7 @@ object ApiCriterion { text = richCriterion.criterion.text, isCompound = richCriterion.criterion.isCompound, labels = richCriterion.labels.map(ApiCriterionLabel.fromDomain), - trialId = richCriterion.criterion.trialId.id + trialId = richCriterion.criterion.trialId.id, + inclusion = richCriterion.criterion.inclusion ) } |