Fixed centroid visibility evaluation

This commit is contained in:
Fabio Sinibaldi 2022-11-09 18:35:44 +01:00
parent 5442e727df
commit 0a653f2eda
1 changed files with 15 additions and 7 deletions

View File

@ -210,14 +210,14 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
if(!indexingProject.getRelationshipsByName(FOLLOWS).isEmpty())
scanRelation(projects,access.getRelations(indexingProject.getProfileID(), indexingProject.getId(), FOLLOWS,true).get(0),false);
log.debug("Produced full chain from {}, evaluating last available for PHASE {} ",indexingProject.getId(),
log.debug("Produced full chain [size : {}] from {}, evaluating last available for PHASE {} ",projects.size(),indexingProject.getId(),
indexingProject.getLifecycleInformation().getPhase());
List<String> toDisplayId = new ArrayList<>();
List<String> toHideIds = new ArrayList<>();
log.trace("Checking from LAST.. ");
// recurse from last
// Projects is time -ordered so we scan from last
for(int i = projects.size()-1;i>=0;i--) {
Project p = projects.get(i);
log.debug("Currently checking {} : {}",p.getId(),p.getTheDocument().get("nome"));
@ -225,11 +225,15 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
toHideIds.add(p.getId());
else {
//Still need to find candidate for displaying feature
// Check PHASE
switch(indexingProject.getLifecycleInformation().getPhase()){
//Our currently indexing project is always a good candidate
if(p.getId().equals(indexingProject.getId()))
toDisplayId.add(p.getId());
//We check PHASE in order to skip projects not yet in the PHASE we are indexing
else switch(indexingProject.getLifecycleInformation().getPhase()){
case Phases.PENDING_APPROVAL:{
if (p.getLifecycleInformation().getPhase().equals(Phases.PENDING_APPROVAL)||
p.getLifecycleInformation().getPhase().equals(Phases.PUBLISHED))
if ((p.getLifecycleInformation().getPhase().equals(Phases.PENDING_APPROVAL)||
p.getLifecycleInformation().getPhase().equals(Phases.PUBLISHED)))
toDisplayId.add(p.getId());
break;
}
@ -239,7 +243,8 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
break;
}
}
if(toDisplayId != null)
if(!toDisplayId.isEmpty())
log.debug("Found last concessioni candidate for displaying. ID {}, PHASE {} ",toDisplayId,p.getLifecycleInformation().getPhase());
else toHideIds.add(p.getId()); // Still not found
}
@ -247,6 +252,9 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
toReturn.put("_toHideIds",toHideIds);
toReturn.put("_toDisplayIds",toDisplayId);
log.info("Indexing request for Concessione [ID {}] with to HIDE {} and toDisplay {} ",indexingProject.getId(),toHideIds,toDisplayId);
return toReturn;
} catch (Exception e) {
log.error("Unable to evaluate to Hide and Display Ids ",e);