use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class CorruptionRiskDashboardCrosstabTest method testI038CrossTab.
@Test
public void testI038CrossTab() {
List<DBObject> flagStats = flagI038CrosstabController.flagStats(new YearFilterPagingRequest());
Assert.assertEquals(0, flagStats.size());
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class CorruptionRiskDashboardCrosstabTest method test180CrossTab.
@Test
public void test180CrossTab() {
List<DBObject> flagStats = flagI180CrosstabController.flagStats(new YearFilterPagingRequest());
Assert.assertEquals(0, flagStats.size());
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class CorruptionRiskDashboardCrosstabTest method testI007CrossTab.
@Test
public void testI007CrossTab() {
List<DBObject> flagStats = flagI007CrosstabController.flagStats(new YearFilterPagingRequest());
Assert.assertEquals(1, flagStats.get(0).get(flagI007CrosstabController.getFlagDesignation(FlagsConstants.I007_VALUE)));
Assert.assertEquals(1, flagStats.get(0).get(flagI007CrosstabController.getFlagDesignation(FlagsConstants.I019_VALUE)));
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class TenderPriceByTypeYearController method tenderPriceByAllBidSelectionMethods.
@ApiOperation(value = "Same as /api/tenderPriceByBidSelectionMethod, but it always returns " + "all bidSelectionMethods (it adds the missing bid selection methods with zero totals")
@RequestMapping(value = "/api/tenderPriceByAllBidSelectionMethods", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json")
public List<DBObject> tenderPriceByAllBidSelectionMethods(@ModelAttribute @Valid final YearFilterPagingRequest filter) {
List<DBObject> tenderPriceByBidSelectionMethod = tenderPriceByBidSelectionMethod(filter);
// create a treeset ordered by procurment method details key
Collection<DBObject> ret = new TreeSet<>((DBObject o1, DBObject o2) -> o1.get(Keys.PROCUREMENT_METHOD_DETAILS).toString().compareTo(o2.get(Keys.PROCUREMENT_METHOD_DETAILS).toString()));
// add them all to sorted set
for (DBObject o : tenderPriceByBidSelectionMethod) {
if (o.containsField(Keys.PROCUREMENT_METHOD_DETAILS) && o.get(Keys.PROCUREMENT_METHOD_DETAILS) != null) {
ret.add(o);
} else {
o.put(Keys.PROCUREMENT_METHOD_DETAILS, UNSPECIFIED);
ret.add(o);
}
}
// get all the non null bid selection methods
Set<Object> bidSelectionMethods = bidSelectionMethodSearchController.bidSelectionMethods().stream().filter(e -> e.get(Fields.UNDERSCORE_ID) != null).map(e -> e.get(Fields.UNDERSCORE_ID)).collect(Collectors.toCollection(LinkedHashSet::new));
bidSelectionMethods.add(UNSPECIFIED);
// remove elements that already are in the result
bidSelectionMethods.removeAll(ret.stream().map(e -> e.get(Keys.PROCUREMENT_METHOD_DETAILS)).collect(Collectors.toSet()));
// add the missing procurementmethoddetails with zero amounts
bidSelectionMethods.forEach(e -> {
DBObject obj = new BasicDBObject(Keys.PROCUREMENT_METHOD_DETAILS, e.toString());
obj.put(Keys.TOTAL_TENDER_AMOUNT, BigDecimal.ZERO);
ret.add(obj);
});
return new ArrayList<>(ret);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class OcdsControllerTest method ocdsReleases.
@Test
public void ocdsReleases() throws Exception {
final List<Release> releases = ocdsController.ocdsReleases(new YearFilterPagingRequest());
Assert.assertEquals(3, releases.size());
}
Aggregations