use of org.devgateway.ocds.persistence.mongo.FlaggedRelease in project ocvn by devgateway.
the class ReleaseFlagI019Processor method calculateFlag.
@Override
protected Boolean calculateFlag(FlaggedRelease flaggable, StringBuffer rationale) {
Optional<Award> award = flaggable.getAwards().stream().filter(a -> a.getDate() != null && Award.Status.active.equals(a.getStatus())).findFirst();
if (!award.isPresent()) {
return false;
}
Days daysBetween = Days.daysBetween(new DateTime(flaggable.getTender().getTenderPeriod().getEndDate()), new DateTime(award.get().getDate()));
rationale.append("Days between: ").append(daysBetween.getDays()).append("; Max allowed days: ").append(MAX_ALLOWED_DAYS_TENDER_END_DATE_AWARD_DATE).append(";");
return daysBetween.getDays() > MAX_ALLOWED_DAYS_TENDER_END_DATE_AWARD_DATE;
}
use of org.devgateway.ocds.persistence.mongo.FlaggedRelease in project ocvn by devgateway.
the class ReleaseFlaggingServiceTest method testI077.
@Test
public void testI077() {
FlaggedRelease release1 = flaggedReleaseRepository.findByOcid("ocds-endpoint-001");
Assert.assertNotNull(release1);
Assert.assertEquals(false, release1.getFlags().getI077().getValue());
Assert.assertEquals(true, release1.getFlags().getI077().getTypes().contains(FlagType.RIGGING));
Assert.assertEquals(1, release1.getFlags().getI077().getTypes().size());
FlaggedRelease release2 = flaggedReleaseRepository.findByOcid("ocds-endpoint-002");
Assert.assertNotNull(release2);
Assert.assertEquals(false, release2.getFlags().getI077().getValue());
Assert.assertEquals(true, release2.getFlags().getI077().getTypes().contains(FlagType.RIGGING));
Assert.assertEquals(1, release2.getFlags().getI077().getTypes().size());
}
use of org.devgateway.ocds.persistence.mongo.FlaggedRelease in project ocvn by devgateway.
the class ReleaseFlaggingServiceTest method testI007.
@Test
public void testI007() {
FlaggedRelease release1 = flaggedReleaseRepository.findByOcid("ocds-endpoint-001");
Assert.assertNotNull(release1);
Assert.assertEquals(true, release1.getFlags().getI007().getValue());
Assert.assertEquals(true, release1.getFlags().getI007().getTypes().contains(FlagType.RIGGING));
Assert.assertEquals(1, release1.getFlags().getI007().getTypes().size());
FlaggedRelease release2 = flaggedReleaseRepository.findByOcid("ocds-endpoint-002");
Assert.assertNotNull(release2);
Assert.assertEquals(null, release2.getFlags().getI007().getValue());
Assert.assertEquals(true, release2.getFlags().getI007().getTypes().contains(FlagType.RIGGING));
Assert.assertEquals(1, release2.getFlags().getI007().getTypes().size());
}
use of org.devgateway.ocds.persistence.mongo.FlaggedRelease in project ocvn by devgateway.
the class ReleaseFlaggingServiceTest method testI180.
@Test
public void testI180() {
FlaggedRelease release1 = flaggedReleaseRepository.findByOcid("ocds-endpoint-001");
Assert.assertNotNull(release1);
Assert.assertEquals(null, release1.getFlags().getI180().getValue());
Assert.assertEquals(true, release1.getFlags().getI180().getTypes().contains(FlagType.RIGGING));
Assert.assertEquals(1, release1.getFlags().getI180().getTypes().size());
FlaggedRelease release2 = flaggedReleaseRepository.findByOcid("ocds-endpoint-002");
Assert.assertNotNull(release2);
Assert.assertEquals(null, release2.getFlags().getI180().getValue());
Assert.assertEquals(true, release2.getFlags().getI180().getTypes().contains(FlagType.RIGGING));
Assert.assertEquals(1, release2.getFlags().getI180().getTypes().size());
}
use of org.devgateway.ocds.persistence.mongo.FlaggedRelease in project ocvn by devgateway.
the class ReleaseFlaggingServiceTest method testFlaggedEligibleTypes.
@Test
public void testFlaggedEligibleTypes() {
FlaggedRelease release1 = flaggedReleaseRepository.findByOcid("ocds-endpoint-001");
Assert.assertNotNull(release1);
Assert.assertEquals(2, release1.getFlags().getFlaggedStats().stream().filter(f -> f.getType().equals(FlagType.RIGGING)).findFirst().get().getCount(), 0);
Assert.assertEquals(5, release1.getFlags().getEligibleStats().stream().filter(f -> f.getType().equals(FlagType.RIGGING)).findFirst().get().getCount(), 0);
FlaggedRelease release2 = flaggedReleaseRepository.findByOcid("ocds-endpoint-002");
Assert.assertNotNull(release2);
Assert.assertEquals(false, release2.getFlags().getFlaggedStats().stream().filter(f -> f.getType().equals(FlagType.RIGGING)).findFirst().isPresent());
Assert.assertEquals(1, release2.getFlags().getEligibleStats().stream().filter(f -> f.getType().equals(FlagType.RIGGING)).findFirst().get().getCount(), 0);
}
Aggregations