diff --git a/nio-server/app/models/ConsentFact.scala b/nio-server/app/models/ConsentFact.scala index bc6e568..59d2e43 100644 --- a/nio-server/app/models/ConsentFact.scala +++ b/nio-server/app/models/ConsentFact.scala @@ -55,12 +55,12 @@ object DoneBy { case class Consent(key: String, label: String, checked: Boolean, expiredAt: Option[LocalDateTime] = None) { - def isActive: Bool = { + def isActive: Boolean = { val now = LocalDateTime.now(Clock.systemUTC()) - c.expiredAt.isEmpty || c.expiredAt.exists(d => d.isAfter(now)) + this.expiredAt.isEmpty || this.expiredAt.exists(d => d.isAfter(now)) } - def isExpired: Bool = !isActive + def isExpired: Boolean = !isActive def asXml(): Elem = @@ -435,7 +435,7 @@ case class ConsentFact( {version} - {groups.filter(cf => cf.consents).map(_.asXml())} + {groups.filter(cf => cf.consents.nonEmpty).map(_.asXml())} { diff --git a/nio-server/app/models/Permission.scala b/nio-server/app/models/Permission.scala index 6c74c7a..67b4621 100644 --- a/nio-server/app/models/Permission.scala +++ b/nio-server/app/models/Permission.scala @@ -12,7 +12,7 @@ import play.api.libs.json.* import play.api.libs.json.Reads.* import utils.Result.AppErrors -import java.time.{Clock, LocalDateTime, ZoneId} +import java.time.{Clock, LocalDateTime} import scala.concurrent.duration.{Duration, FiniteDuration} import scala.util.{Failure, Success, Try} import scala.xml.{Elem, NodeBuffer, NodeSeq} diff --git a/nio-server/app/service/ConsentManagerService.scala b/nio-server/app/service/ConsentManagerService.scala index b900ab4..5fd3db3 100644 --- a/nio-server/app/service/ConsentManagerService.scala +++ b/nio-server/app/service/ConsentManagerService.scala @@ -394,9 +394,11 @@ class ConsentManagerService( } .getOrElse(group) + val consentFactFiltered = consentFact.filterExpiredConsent(true) val groupsUpdated: Seq[ConsentGroup] = template.groups.map { group => - val maybeGroup = consentFact.filterExpiredConsent(true).find(cg => cg.key == group.key && cg.label == group.label) + val maybeGroup = consentFactFiltered.groups + .find(cg => cg.key == group.key && cg.label == group.label) mergeConsentGroup(maybeGroup, group) }