diff --git a/app/binders/QueryBinders.scala b/app/binders/QueryBinders.scala index 541eb2a..9493aca 100644 --- a/app/binders/QueryBinders.scala +++ b/app/binders/QueryBinders.scala @@ -26,7 +26,7 @@ object QueryBinders { str => str.split('-') match { case Array(sha1, md5) => Hashes(sha1 = sha1, md5 = md5) }, - hashes => s"${hashes.sha1}-${hashes.md5}" + hashes => hashes.serialized ) implicit object MapStringIntJavascriptLiteral extends JavascriptLiteral[Map[String, Int]] { diff --git a/app/com/ysoft/odc/OdcParser.scala b/app/com/ysoft/odc/OdcParser.scala index e5bf4eb..0999934 100644 --- a/app/com/ysoft/odc/OdcParser.scala +++ b/app/com/ysoft/odc/OdcParser.scala @@ -30,6 +30,7 @@ final case class Analysis(scanInfo: SerializableXml, name: String, reportDate: D final case class Hashes(sha1: String, md5: String){ override def toString: String = s"Hashes(sha1=$sha1, md5=$md5)" + def serialized = s"$sha1-$md5" } final case class Exclusion(sha1: String) extends AnyVal { @@ -76,8 +77,8 @@ final case class GroupedDependency(dependencies: Map[Dependency, Set[ReportInfo] def descriptions = dependencies.keySet.map(_.description) def projects = dependencies.values.flatten.toSet def fileNames = dependencies.keySet.map(_.fileName) - def hashes = dependencies.keys.head.hashes // valid since all deps in a group have the same hashes - val sha1 = hashes.sha1 + val hashes: Hashes = dependencies.keys.head.hashes // valid since all deps in a group have the same hashes + def sha1: String = hashes.sha1 def identifiers: Set[Identifier] = dependencies.keySet.flatMap(_.identifiers) def evidenceCollected: Set[Evidence] = dependencies.keySet.flatMap(_.evidenceCollected) def suppressedIdentifiers: Set[Identifier] = dependencies.keySet.flatMap(_.suppressedIdentifiers) diff --git a/app/controllers/Statistics.scala b/app/controllers/Statistics.scala index 59f7733..eab4fae 100644 --- a/app/controllers/Statistics.scala +++ b/app/controllers/Statistics.scala @@ -48,7 +48,7 @@ object Statistics{ // TODO: Move this to a better place - implicit val hashesWrites = Writes[Hashes](h => JsString(s"${h.sha1}-${h.md5}")) + implicit val hashesWrites = Writes[Hashes](h => JsString(h.serialized)) implicit val confidenceWrites = Writes[Confidence](c => JsString(c.toString)) implicit val identifierWrites = Json.writes[Identifier] implicit val evidenceWrites = Json.writes[Evidence] diff --git a/app/views/dependencyList.scala.html b/app/views/dependencyList.scala.html index 5a5def4..aa888a2 100644 --- a/app/views/dependencyList.scala.html +++ b/app/views/dependencyList.scala.html @@ -12,7 +12,7 @@