From 14b460edbebb1d5c39809dbc591b786edec9fa8e Mon Sep 17 00:00:00 2001 From: Kseniya Tomskikh Date: Mon, 2 Oct 2017 15:21:58 +0700 Subject: TRIAL-17 Added 'inclusion' field to Criterion --- .../pdsuidomain/formats/json/criterion/ApiNewCriterion.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiNewCriterion.scala') diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiNewCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiNewCriterion.scala index ab7641f..d72a9b4 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiNewCriterion.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiNewCriterion.scala @@ -13,7 +13,8 @@ final case class ApiNewCriterion(meta: Option[String], text: Option[String], isCompound: Option[Boolean], labels: Seq[ApiCriterionLabel], - trialId: String) { + trialId: String, + inclusion: Option[Boolean]) { def toDomain = RichCriterion( criterion = Criterion( @@ -21,7 +22,8 @@ final case class ApiNewCriterion(meta: Option[String], meta = meta.getOrElse(""), trialId = StringId(trialId), isCompound = isCompound.getOrElse(false), - text = text + text = text, + inclusion = inclusion ), armIds = arms.getOrElse(Seq.empty).map(LongId[Arm]), labels = labels.map(_.toDomain(LongId(Long.MaxValue))) // A developer should specify right criterionId himself @@ -38,6 +40,7 @@ object ApiNewCriterion { (JsPath \ "text").formatNullable[String] and (JsPath \ "isCompound").formatNullable[Boolean] and (JsPath \ "labels").format(seqJsonFormat[ApiCriterionLabel]) and - (JsPath \ "trialId").format[String] + (JsPath \ "trialId").format[String] and + (JsPath \ "inclusion").formatNullable[Boolean] )(ApiNewCriterion.apply, unlift(ApiNewCriterion.unapply)) } -- cgit v1.2.3