Skip to content

Commit

Permalink
Use correct types to appease Codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
hermann-p committed Jul 14, 2023
1 parent 8bdfc5c commit 242af47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/com/campudus/tableaux/helper/JsonUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ object JsonUtils extends LazyLogging {
} yield result).get
}

def toColumnSeq(json: JsonObject) = {
def toColumnIdSeq(json: JsonObject) = {
for {
columnsObject <- toJsonObjectSeq("columns", json)
columns = sequence(columnsObject.map(hasLong("id", _)))
} yield columns.get
} yield columns
}

def toColumnValueSeq(json: JsonObject): Seq[Seq[(ColumnId, _)]] = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.campudus.tableaux.router

import com.campudus.tableaux.{InvalidJsonException, NoJsonFoundException, TableauxConfig}
import com.campudus.tableaux.OkArg
import com.campudus.tableaux.controller.TableauxController
import com.campudus.tableaux.database.domain.{CellAnnotationType, Pagination}
import com.campudus.tableaux.database.model.DuplicateRowOptions
Expand Down Expand Up @@ -560,8 +561,12 @@ class TableauxRouter(override val config: TableauxConfig, val controller: Tablea
val body = Try(getJson(context)).toOption
val specificColumnsIds =
body.filter(_.containsKey("columns"))
.map(toColumnSeq)
.map(_.get)
.map(toColumnIdSeq)
.flatMap(_.toOption)
.flatMap(_ match {
case OkArg(value) => Some(value)
case _ => None
})
val duplicateOptions = DuplicateRowOptions(
getBoolParam("skipConstrainedLinks", context).getOrElse(false),
getBoolParam("annotateSkipped", context).getOrElse(false),
Expand Down

0 comments on commit 242af47

Please sign in to comment.