in src/main/scala/com/gu/octopusthrift/services/ArticleFinder.scala [23:38]
private def cleanObjectType(objectType: String): String = objectType.split("\\[").head.trim
// Prefer articles that are labelled both, then web, then print
private def articlesForPreferredDestination(
articles: Map[String, Array[OctopusArticle]]): Array[OctopusArticle] = {
val forBoth = Try(articles(ForBoth))
val forWeb = Try(articles(ForWeb))
val forPrint = Try(articles(ForPrint))
(forBoth, forWeb, forPrint) match {
case (Success(both), _, _) => both
case (Failure(_), Success(web), _) => web
case (Failure(_), Failure(_), Success(print)) => print
case _ => Array.empty[OctopusArticle]
}
}