Skip to content

Commit

Permalink
Merge pull request #2170 from vdebergue/fix/duplicated-case-reported
Browse files Browse the repository at this point in the history
Make sure nextCaseNumber is called for each duplicated case number
  • Loading branch information
To-om authored Aug 26, 2021
2 parents 5e75521 + 3df4018 commit aa6d529
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions thehive/app/org/thp/thehive/services/CaseSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -716,16 +716,14 @@ class CaseIntegrityCheckOps @Inject() (
) extends IntegrityCheckOps[Case] {

override def resolve(entities: Seq[Case with Entity])(implicit graph: Graph): Try[Unit] = {
val nextNumber = service.nextCaseNumber
EntitySelector
.firstCreatedEntity(entities)
.foreach(
_._2
.flatMap(service.get(_).setConverter[Vertex, Converter.Identity[Vertex]](Converter.identity).headOption)
.zipWithIndex
.foreach {
case (vertex, index) =>
UMapping.int.setProperty(vertex, "number", nextNumber + index)
.foreach { vertex =>
val nextNumber = service.nextCaseNumber
UMapping.int.setProperty(vertex, "number", nextNumber)
}
)
Success(())
Expand Down

0 comments on commit aa6d529

Please sign in to comment.