test_class.declarator: averageNumberOfTenderersController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private AverageNumberOfTenderersController averageNumberOfTenderersController;
test_class.type: AverageNumberOfTenderersController
test_class.var_name: averageNumberOfTenderersController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/AverageNumberOfTenderersControllerTest.java
test_class.identifier: AverageNumberOfTenderersControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void averageNumberOfTenderers() throws Exception {
          final List<Document> averageNumberOfTenderers = averageNumberOfTenderersController
                  .averageNumberOfTenderersYearly(new YearFilterPagingRequest());
  
          final Document sec = averageNumberOfTenderers.get(1);
          int year = (int) sec.get(AverageNumberOfTenderersController.Keys.YEAR);
          double averageNoTenderers = (double) sec.get(AverageNumberOfTenderersController.Keys.AVERAGE_NO_OF_TENDERERS);
          Assert.assertEquals(2015, year);
          Assert.assertEquals(5.5, averageNoTenderers, 0);
  
          final Document first = averageNumberOfTenderers.get(0);
          year = (int) first.get(AverageNumberOfTenderersController.Keys.YEAR);
          averageNoTenderers = (double) first.get(AverageNumberOfTenderersController.Keys.AVERAGE_NO_OF_TENDERERS);
          Assert.assertEquals(2014, year);
          Assert.assertEquals(5.0, averageNoTenderers, 0);
      }
test_case.class_method_signature: AverageNumberOfTenderersControllerTest.averageNumberOfTenderers()
test_case.full_signature: @Test public void averageNumberOfTenderers()
test_case.identifier: averageNumberOfTenderers
test_case.invocations: averageNumberOfTenderersYearly get get get assertEquals assertEquals get get get assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void averageNumberOfTenderers()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/AverageNumberOfTenderersController.java
focal_class.identifier: AverageNumberOfTenderersController
focal_class.class_method_signature: AverageNumberOfTenderersController.averageNumberOfTenderersYearly(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Calculate average number of tenderers, by year. The endpoint can be filtered" + "by year read from tender.tenderPeriod.startDate. " + "The number of tenderers are read from tender.numberOfTenderers") @RequestMapping(value = "/api/averageNumberOfTenderersYearly", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> averageNumberOfTenderersYearly(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: averageNumberOfTenderersYearly
focal_class.modifiers: @ApiOperation(value = "Calculate average number of tenderers, by year. The endpoint can be filtered" + "by year read from tender.tenderPeriod.startDate. " + "The number of tenderers are read from tender.numberOfTenderers") @RequestMapping(value = "/api/averageNumberOfTenderersYearly", 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> averageNumberOfTenderersYearly(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: AverageNumberOfTenderersController.averageNumberOfTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Calculate average number of tenderers. The endpoint can be filtered" + "by year read from tender.tenderPeriod.startDate. " + "The number of tenderers are read from tender.numberOfTenderers") @RequestMapping(value = "/api/averageNumberOfTenderers", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> averageNumberOfTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: averageNumberOfTenderers
focal_class.modifiers: @ApiOperation(value = "Calculate average number of tenderers. The endpoint can be filtered" + "by year read from tender.tenderPeriod.startDate. " + "The number of tenderers are read from tender.numberOfTenderers") @RequestMapping(value = "/api/averageNumberOfTenderers", 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> averageNumberOfTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "Calculate average number of tenderers. The endpoint can be filtered"
              + "by year read from tender.tenderPeriod.startDate. "
              + "The number of tenderers are read from tender.numberOfTenderers")
  
      @RequestMapping(value = "/api/averageNumberOfTenderers",
              method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json")
      public List<Document> averageNumberOfTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          DBObject project = new BasicDBObject();
          addYearlyMonthlyProjection(filter, project, ref(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE));
          project.put(MongoConstants.FieldNames.TENDER_NO_TENDERERS, 1);
  
          Aggregation agg = newAggregation(
                  match(where(MongoConstants.FieldNames.TENDER_NO_TENDERERS).gt(0)
                          .and(MongoConstants.FieldNames.TENDER_PERIOD_START_DATE).exists(true)
                          .andOperator(getYearDefaultFilterCriteria(filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE))),
                  new CustomProjectionOperation(project),
                  group().avg(MongoConstants.FieldNames.TENDER_NO_TENDERERS)
                          .as(Keys.AVERAGE_NO_OF_TENDERERS));
  
  
         return releaseAgg(agg);
      }
focal_method.class_method_signature: AverageNumberOfTenderersController.averageNumberOfTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "Calculate average number of tenderers. The endpoint can be filtered" + "by year read from tender.tenderPeriod.startDate. " + "The number of tenderers are read from tender.numberOfTenderers") @RequestMapping(value = "/api/averageNumberOfTenderers", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json") public List<Document> averageNumberOfTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: averageNumberOfTenderers
focal_method.invocations: addYearlyMonthlyProjection ref put newAggregation match andOperator exists and gt where getYearDefaultFilterCriteria as avg group releaseAgg
focal_method.modifiers: @ApiOperation(value = "Calculate average number of tenderers. The endpoint can be filtered" + "by year read from tender.tenderPeriod.startDate. " + "The number of tenderers are read from tender.numberOfTenderers") @RequestMapping(value = "/api/averageNumberOfTenderers", 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> averageNumberOfTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)