From 991f8dfe9862d34ff2bff71a851e92ebe68575b0 Mon Sep 17 00:00:00 2001 From: Pascal Christoph Date: Mon, 6 Nov 2023 11:31:39 +0100 Subject: [PATCH] Remove unused imports - replace !.isEmpty with nonEmpty - remove unnecessary parentheses --- app/views/tags/result_short.scala.html | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/tags/result_short.scala.html b/app/views/tags/result_short.scala.html index 9af48ac..83c286a 100644 --- a/app/views/tags/result_short.scala.html +++ b/app/views/tags/result_short.scala.html @@ -3,17 +3,15 @@ @(id:String, doc: play.api.libs.json.JsValue, i: Int = -1, hits: Seq[String] = Seq()) @import play.api.libs.json._ -@import views.TableRow @import controllers.nwbib.Lobid -@import scala.collection.immutable.Map @import play.mvc.Controller.session @import play.cache.Cache @import controllers.nwbib.Application @optional(doc: JsValue, key: String, sep: String, alt: String)=@{ - val other = (doc \\ key) - if(!other.isEmpty){ - sep + other(0).asOpt[String].getOrElse(other(0).as[Seq[JsValue]].map(_.as[String]).mkString("; ")) + val other = doc \\ key + if(other.nonEmpty){ + sep + other.head.asOpt[String].getOrElse(other.head.as[Seq[JsValue]].map(_.as[String]).mkString("; ")) } else {alt} }