private def articlesOfPreferredObjectType()

in src/main/scala/com/gu/octopusthrift/services/ArticleFinder.scala [41:53]


  private def articlesOfPreferredObjectType(
    articles: Map[String, Array[OctopusArticle]]): Array[OctopusArticle] = {
    val bodyText = Try(articles(BodyText))
    val panelText = Try(articles(PanelText))
    val tabularText = Try(articles(TabularText))

    (bodyText, panelText, tabularText) match {
      case (Success(bodyTexts), _, _) => bodyTexts
      case (Failure(_), Success(panelTexts), _) => panelTexts
      case (Failure(_), Failure(_), Success(tabularTexts)) => tabularTexts
      case _ => Array.empty[OctopusArticle]
    }
  }