Skip to content

Commit

Permalink
[HOTFIX] Exclut les moyens archivés des unités legacy (#915)
Browse files Browse the repository at this point in the history
## Related Pull Requests & Issues

- #699

----

- [ ] Tests E2E (Cypress)
  • Loading branch information
ivangabriele committed Oct 25, 2023
2 parents ccf2b92 + 69894b3 commit ad8916f
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ class GetLegacyControlUnits(private val controlUnitRepository: IControlUnitRepos

fun execute(): List<LegacyControlUnitEntity> {
val controlUnits = controlUnitRepository.findAll()
logger.info("Found ${controlUnits.size} control units")
val controlUnitsWithActiveControlUnitResources = controlUnits.map { controlUnit ->
controlUnit.copy(
controlUnitResources = controlUnit.controlUnitResources.filter {
!it.controlUnitResource.isArchived
},
)
}
logger.info("Found ${controlUnitsWithActiveControlUnitResources.size} control units.")

return controlUnits.map { it.toLegacyControlUnit() }
return controlUnitsWithActiveControlUnitResources.map { it.toLegacyControlUnit() }
}
}

0 comments on commit ad8916f

Please sign in to comment.