test_class.declarator: frequentTenderersController
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private FrequentTenderersController frequentTenderersController;
test_class.type: FrequentTenderersController
test_class.var_name: frequentTenderersController
test_class.file: web/src/test/java/org/devgateway/ocds/web/rest/controller/FrequentTenderersControllerTest.java
test_class.identifier: FrequentTenderersControllerTest
test_class.superclass: extends AbstractEndPointControllerTest
test_case.body: @Test
      public void activeAwardsCountTest() throws Exception {
          final List<Document> frequentTenderers = frequentTenderersController
                  .activeAwardsCount(new YearFilterPagingRequest());
  
          Assert.assertEquals(2, frequentTenderers.size());
          Assert.assertEquals(1, frequentTenderers.get(0).get("cnt"));
          Assert.assertEquals(1, frequentTenderers.get(1).get("cnt"));
      }
test_case.class_method_signature: FrequentTenderersControllerTest.activeAwardsCountTest()
test_case.full_signature: @Test public void activeAwardsCountTest()
test_case.identifier: activeAwardsCountTest
test_case.invocations: activeAwardsCount assertEquals size assertEquals get get assertEquals get get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void activeAwardsCountTest()
focal_class.file: web/src/main/java/org/devgateway/ocds/web/rest/controller/FrequentTenderersController.java
focal_class.identifier: FrequentTenderersController
focal_class.class_method_signature: FrequentTenderersController.frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Detect frequent pairs of tenderers that apply together to bids." + "We are only showing pairs if they applied to more than one bid together." + "We are sorting the results after the number of occurences, descending." + "You can use all the filters that are available along with pagination options.") @RequestMapping(value = "/api/frequentTenderers", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: frequentTenderers
focal_class.modifiers: @ApiOperation(value = "Detect frequent pairs of tenderers that apply together to bids." + "We are only showing pairs if they applied to more than one bid together." + "We are sorting the results after the number of occurences, descending." + "You can use all the filters that are available along with pagination options.") @RequestMapping(value = "/api/frequentTenderers", 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> frequentTenderers(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.class_method_signature: FrequentTenderersController.activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.full_signature: @ApiOperation(value = "Counts the tenders/awards where the given supplier id is among the winners. " + "This assumes there is only one active award, which always seems to be the case, per tender. ") @RequestMapping(value = "/api/activeAwardsCount", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.identifier: activeAwardsCount
focal_class.modifiers: @ApiOperation(value = "Counts the tenders/awards where the given supplier id is among the winners. " + "This assumes there is only one active award, which always seems to be the case, per tender. ") @RequestMapping(value = "/api/activeAwardsCount", 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> activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_class.superclass: extends GenericOCDSController
focal_method.body: @ApiOperation(value = "Counts the tenders/awards where the given supplier id is among the winners. "
              + "This assumes there is only  one active award, which always seems to be the case, per tender. ")
      @RequestMapping(value = "/api/activeAwardsCount",
              method = {RequestMethod.POST, RequestMethod.GET},
              produces = "application/json")
      public List<Document> activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter) {
  
          Aggregation agg = newAggregation(
                  match(where(MongoConstants.FieldNames.AWARDS_STATUS).is(Award.Status.active.toString())
                          .andOperator(getYearDefaultFilterCriteria(
                                  filter,
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE
                          ))),
                  unwind("awards"),
                  match(where(MongoConstants.FieldNames.AWARDS_STATUS).is(Award.Status.active.toString())
                          .andOperator(getYearDefaultFilterCriteria(
                                  filter.awardFiltering(),
                                  MongoConstants.FieldNames.TENDER_PERIOD_START_DATE
                          ))),
                  unwind("awards.suppliers"),
                  group(MongoConstants.FieldNames.AWARDS_SUPPLIERS_ID).count().as("cnt"),
                  project("cnt").and(Fields.UNDERSCORE_ID).as("supplierId")
                          .andExclude(Fields.UNDERSCORE_ID)
          );
  
          return releaseAgg(agg);
      }
focal_method.class_method_signature: FrequentTenderersController.activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.full_signature: @ApiOperation(value = "Counts the tenders/awards where the given supplier id is among the winners. " + "This assumes there is only one active award, which always seems to be the case, per tender. ") @RequestMapping(value = "/api/activeAwardsCount", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json") public List<Document> activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)
focal_method.identifier: activeAwardsCount
focal_method.invocations: newAggregation match andOperator is where toString getYearDefaultFilterCriteria unwind match andOperator is where toString getYearDefaultFilterCriteria awardFiltering unwind as count group andExclude as and project releaseAgg
focal_method.modifiers: @ApiOperation(value = "Counts the tenders/awards where the given supplier id is among the winners. " + "This assumes there is only one active award, which always seems to be the case, per tender. ") @RequestMapping(value = "/api/activeAwardsCount", 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> activeAwardsCount(@ModelAttribute @Valid final YearFilterPagingRequest filter)