Skip to content
Snippets Groups Projects

Resolve "Job offers without actions should be collapsed by default"

Files

@@ -34,6 +34,7 @@ import nl.tudelft.tam.dto.view.details.ApplicationDetailsPersonDTO;
import nl.tudelft.tam.dto.view.details.JobOfferDetailsDTO;
import nl.tudelft.tam.dto.view.summary.ApplicationStatusSummaryDTO;
import nl.tudelft.tam.dto.view.summary.ApplicationSummaryDTO;
import nl.tudelft.tam.dto.view.summary.JobOfferSummaryDTO;
import nl.tudelft.tam.enums.Status;
import nl.tudelft.tam.exception.ApplicationStatusException;
import nl.tudelft.tam.model.Application;
@@ -638,4 +639,19 @@ public class ApplicationService {
return !previousRoles.isEmpty();
}
/**
* Checks whether there are no valid student actions at the moment
*
* @param editionOffers The offers for an edition
* @param map Map which maps offer ids to a status summary
* @return Checks whether all offers of an edition require no more student actions
*/
public boolean checkEditionCollapsable(List<JobOfferSummaryDTO> editionOffers,
Map<Long, ApplicationStatusSummaryDTO> offerStatusMap) {
var collapsableFilter = Set.of(Status.ACCEPTED, Status.REJECTED_BY_TEACHER);
return editionOffers.stream().allMatch(offer -> offer.getHiringMessage() == null)
&& editionOffers.stream().map(offer -> offerStatusMap.get(offer.getId()))
.allMatch(offer -> offer.exists() && collapsableFilter.contains(offer.getStatus()));
}
}
Loading