From 7dfcb182dee175d5f3341f0fc7a681fb64b29529 Mon Sep 17 00:00:00 2001 From: To-om Date: Mon, 15 Jun 2020 12:42:30 +0200 Subject: [PATCH] #1371 Fix handling duration calculation --- .../app/org/thp/thehive/controllers/v0/Properties.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/thehive/app/org/thp/thehive/controllers/v0/Properties.scala b/thehive/app/org/thp/thehive/controllers/v0/Properties.scala index efe2bce6b6..e6889dad3f 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/Properties.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/Properties.scala @@ -1,10 +1,10 @@ package org.thp.thehive.controllers.v0 +import java.util.Date + import scala.collection.JavaConverters._ import scala.util.{Failure, Success, Try} - import play.api.libs.json.{JsNull, JsObject, JsValue, Json} - import gremlin.scala.{__, By, Key, P, Vertex} import javax.inject.{Inject, Singleton} import org.scalactic.Accumulation._ @@ -210,8 +210,8 @@ class Properties @Inject() ( _.select( _.coalesce( _.has("endDate") - .sack((_: Long, endDate: Long) => endDate, By(Key[Long]("endDate"))) - .sack((_: Long) - (_: Long), By(Key[Long]("startDate"))) + .sack((_: Long, endDate: Long) => endDate, By(__.value(Key[Date]("endDate")).map(_.getTime))) + .sack((_: Long) - (_: Long), By(__.value(Key[Date]("startDate")).map(_.getTime))) .sack((_: Long) / (_: Long), By(__.constant(3600000L))) .sack[Long](), _.constant(0L)