Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
OY-227 : Sort all applications
Flatmapping a set messed up the order of even
single person oid, and for multiple oids there
is no other solution than sorting here.
  • Loading branch information
timorantalaiho committed Sep 18, 2018
1 parent 6376160 commit 8e6540b
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -3,7 +3,7 @@ package fi.vm.sade.omatsivut.servlet
import fi.vm.sade.groupemailer.GroupEmailComponent
import fi.vm.sade.hakemuseditori._
import fi.vm.sade.hakemuseditori.hakemus.domain.HakemusMuutos
import fi.vm.sade.hakemuseditori.hakemus.{ApplicationValidatorComponent, Fetch, HakemusRepositoryComponent, SpringContextComponent}
import fi.vm.sade.hakemuseditori.hakemus.{ApplicationValidatorComponent, Fetch, HakemusInfo, HakemusRepositoryComponent, SpringContextComponent}
import fi.vm.sade.hakemuseditori.json.JsonFormats
import fi.vm.sade.hakemuseditori.localization.TranslationsComponent
import fi.vm.sade.hakemuseditori.lomake.LomakeRepositoryComponent
Expand Down Expand Up @@ -68,7 +68,7 @@ trait ApplicationsServletContainer {
val allOids: Iterable[String] = oppijanumerorekisteriService.fetchAllDuplicateOids(oppijanumero)

var allSuccess = true
val allHakemukset = allOids.flatMap(oid => {
val allHakemukset: List[HakemusInfo] = allOids.toList.flatMap(oid => {
hakemusEditori.fetchByPersonOid(request, oid, Fetch) match {
case FullSuccess(hakemukset) => hakemukset
case PartialSuccess(partialHakemukset, exceptions) =>
Expand All @@ -80,7 +80,7 @@ trait ApplicationsServletContainer {
allSuccess = false
List.empty
}
})
}).sortBy(_.hakemus.received).reverse

Map("allApplicationsFetched" -> allSuccess, "applications" -> allHakemukset)
}
Expand Down

0 comments on commit 8e6540b

Please sign in to comment.