test_class.declarator: fundingByLocationController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private FundingByLocationController fundingByLocationController;
test_class.type: FundingByLocationController
test_class.var_name: fundingByLocationController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/FundingByLocationControllerTest.java
test_class.identifier: FundingByLocationControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void qualityFundingByTenderDeliveryLocation() throws Exception {
          final List<Document> qualityFundingByTenderDeliveryLocation = fundingByLocationController
                  .qualityFundingByTenderDeliveryLocation(new YearFilterPagingRequest());
  
          final Document first = qualityFundingByTenderDeliveryLocation.get(0);
          int totalTendersWithStartDate = (int) first.get(FundingByLocationController.Keys.TOTAL_TENDERS_WITH_START_DATE);
          int totalTendersWithStartDateAndLocation = (int) first
                  .get(FundingByLocationController.Keys.TOTAL_TENDERS_WITH_START_DATE_AND_LOCATION);
          double percentTendersWithStartDateAndLocation = (double) first
                  .get(FundingByLocationController.Keys.PERCENT_TENDERS_WITH_START_DATE_AND_LOCATION);
  
          Assert.assertEquals(3, totalTendersWithStartDate);
          Assert.assertEquals(1, totalTendersWithStartDateAndLocation);
          Assert.assertEquals(33.33, percentTendersWithStartDateAndLocation, 1E-2);
      }
test_case.class_method_signature: FundingByLocationControllerTest.qualityFundingByTenderDeliveryLocation()
test_case.full_signature: @Test public void qualityFundingByTenderDeliveryLocation()
test_case.identifier: qualityFundingByTenderDeliveryLocation
test_case.invocations: qualityFundingByTenderDeliveryLocation get get get get assertEquals assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void qualityFundingByTenderDeliveryLocation()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/FundingByLocationController.java
focal_class.identifier: FundingByLocationController
focal_class.class_method_signature: FundingByLocationController.fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Total estimated funding (tender.value) grouped by " + "tender.items.deliveryLocation and also grouped by year." + " The endpoint also returns the count of tenders for each location. " + "It responds to all filters. The year is calculated based on tender.tenderPeriod.startDate") @RequestMapping(value = "/api/fundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: fundingByTenderDeliveryLocation
focal_class.modifiers: @ApiOperation(value = "Total estimated funding (tender.value) grouped by " + "tender.items.deliveryLocation and also grouped by year." + " The endpoint also returns the count of tenders for each location. " + "It responds to all filters. The year is calculated based on tender.tenderPeriod.startDate") @RequestMapping(value = "/api/fundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public
focal_class.parameters: (
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.return: List<Document>
focal_class.signature: List<Document> fundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: FundingByLocationController.qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation("Calculates percentage of releases with tender with at least one specified delivery location," + " that is the array tender.items.deliveryLocation has to have items." + "Filters out stub tenders, therefore tender.tenderPeriod.startDate has to exist.") @RequestMapping(value = "/api/qualityFundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: qualityFundingByTenderDeliveryLocation
focal_class.modifiers: @ApiOperation("Calculates percentage of releases with tender with at least one specified delivery location," + " that is the array tender.items.deliveryLocation has to have items." + "Filters out stub tenders, therefore tender.tenderPeriod.startDate has to exist.") @RequestMapping(value = "/api/qualityFundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public
focal_class.parameters: (
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.return: List<Document>
focal_class.signature: List<Document> qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation("Calculates percentage of releases with tender with at least one specified delivery location,"
              + " that is the array tender.items.deliveryLocation has to have items."
              + "Filters out stub tenders, therefore tender.tenderPeriod.startDate has to exist.")
      @RequestMapping(value = "/api/qualityFundingByTenderDeliveryLocation", method = { RequestMethod.POST,
              RequestMethod.GET }, produces = "application/json")
      public List<Document> qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          DBObject project = new BasicDBObject();
          project.putAll(filterProjectMap);
          project.put(Fields.UNDERSCORE_ID, "$tender._id");
          project.put("tenderItemsDeliveryLocation", new BasicDBObject("$cond",
                  Arrays.asList(new BasicDBObject("$gt",
                          Arrays.asList("$tender.items.deliveryLocation", null)), 1, 0)));
  
  
          DBObject project1 = new BasicDBObject();
          project1.put(Fields.UNDERSCORE_ID, 0);
          project1.put(Keys.TOTAL_TENDERS_WITH_START_DATE, 1);
          project1.put(Keys.TOTAL_TENDERS_WITH_START_DATE_AND_LOCATION, 1);
          project1.put(Keys.PERCENT_TENDERS_WITH_START_DATE_AND_LOCATION,
                  new BasicDBObject("$multiply",
                          Arrays.asList(new BasicDBObject("$divide",
                                          Arrays.asList(
                                                  "$totalTendersWithStartDateAndLocation", "$totalTendersWithStartDate")),
                                  100)));
  
          Aggregation agg = newAggregation(
                  match(where(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE).exists(true)
                          .andOperator(getYearDefaultFilterCriteria(filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE))),
                  unwind("$tender.items"), new CustomProjectionOperation(project),
                  group(Fields.UNDERSCORE_ID_REF).max("tenderItemsDeliveryLocation").as("hasTenderItemsDeliverLocation"),
                  group().count().as("totalTendersWithStartDate").sum("hasTenderItemsDeliverLocation")
                          .as(Keys.TOTAL_TENDERS_WITH_START_DATE_AND_LOCATION),
                  new CustomProjectionOperation(project1)
          // ,skip(filter.getSkip()),limit(filter.getPageSize())
          );
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: FundingByLocationController.qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation("Calculates percentage of releases with tender with at least one specified delivery location," + " that is the array tender.items.deliveryLocation has to have items." + "Filters out stub tenders, therefore tender.tenderPeriod.startDate has to exist.") @RequestMapping(value = "/api/qualityFundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: qualityFundingByTenderDeliveryLocation
focal_method.invocations: putAll put put asList asList put put put put asList asList newAggregation match andOperator exists where getYearDefaultFilterCriteria unwind as max group as sum as count group releaseAgg
focal_method.modifiers: @ApiOperation("Calculates percentage of releases with tender with at least one specified delivery location," + " that is the array tender.items.deliveryLocation has to have items." + "Filters out stub tenders, therefore tender.tenderPeriod.startDate has to exist.") @RequestMapping(value = "/api/qualityFundingByTenderDeliveryLocation", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public
focal_method.parameters: (
              @ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.return: List<Document>
focal_method.signature: List<Document> qualityFundingByTenderDeliveryLocation(
              @ModelAttribute @Valid final YearFilterPagingRequest filter)