Skip to content

Commit

Permalink
Swagger + IHM label
Browse files Browse the repository at this point in the history
  • Loading branch information
larousso committed Oct 16, 2024
1 parent 65d9912 commit 3163c54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions nio-server/app/models/ConsentFact.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <consent>
<key>
Expand Down Expand Up @@ -435,7 +435,7 @@ case class ConsentFact(
{version}
</version>
<groups>
{groups.filter(cf => cf.consents).map(_.asXml())}
{groups.filter(cf => cf.consents.nonEmpty).map(_.asXml())}
</groups>

{
Expand Down
2 changes: 1 addition & 1 deletion nio-server/app/models/Permission.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 3 additions & 1 deletion nio-server/app/service/ConsentManagerService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 3163c54

Please sign in to comment.