original_docstring: Return partners by batch type.
docstring: Return partners by batch type.
docstring_tokens: Return partners by batch type .
code: def _get_partners_by_batch_type(cls, batch_type) -> List[CorpTypeModel]:
          """Return partners by batch type."""
          # CREDIT : Ministry GL code -> disbursement_distribution_code_id on distribution_codes table
          # DEBIT : BC Registry GL Code -> distribution_code on fee_schedule, starts with 112
          bc_reg_client_code = current_app.config.get('CGI_BCREG_CLIENT_CODE')  # 112
          query = db.session.query(DistributionCodeModel.distribution_code_id) \
              .filter(DistributionCodeModel.stop_ejv.is_(False)) \
              .filter(DistributionCodeModel.account_id.is_(None)) \
              .filter(DistributionCodeModel.disbursement_distribution_code_id.is_(None))
  
          if batch_type == 'GA':
              # Rule for GA. Credit is 112 and debit is 112.
              partner_distribution_code_ids: List[int] = query.filter(
                  DistributionCodeModel.client == bc_reg_client_code
              ).all()
          else:
              # Rule for GI. Debit is 112 and credit is not 112.
              partner_distribution_code_ids: List[int] = query.filter(
                  DistributionCodeModel.client != bc_reg_client_code
              ).all()
  
          # Find all distribution codes who have these partner distribution codes as disbursement.
          fee_distribution_codes: List[int] = db.session.query(DistributionCodeModel.distribution_code_id).filter(
              DistributionCodeModel.disbursement_distribution_code_id.in_(partner_distribution_code_ids)).all()
  
          corp_type_codes: List[str] = db.session.query(FeeScheduleModel.corp_type_code). \
              join(DistributionCodeLinkModel,
                   DistributionCodeLinkModel.fee_schedule_id == FeeScheduleModel.fee_schedule_id). \
              filter(DistributionCodeLinkModel.distribution_code_id.in_(fee_distribution_codes)).all()
  
          return db.session.query(CorpTypeModel).filter(CorpTypeModel.code.in_(corp_type_codes)).all()
code_tokens: def _get_partners_by_batch_type ( cls , batch_type ) -> List [ CorpTypeModel ] : bc_reg_client_code = current_app . config . get ( 'CGI_BCREG_CLIENT_CODE' ) query = db . session . query ( DistributionCodeModel . distribution_code_id ) . filter ( DistributionCodeModel . stop_ejv . is_ ( False ) ) . filter ( DistributionCodeModel . account_id . is_ ( None ) ) . filter ( DistributionCodeModel . disbursement_distribution_code_id . is_ ( None ) ) if batch_type == 'GA' : partner_distribution_code_ids : List [ int ] = query . filter ( DistributionCodeModel . client == bc_reg_client_code ) . all ( ) else : partner_distribution_code_ids : List [ int ] = query . filter ( DistributionCodeModel . client != bc_reg_client_code ) . all ( ) fee_distribution_codes : List [ int ] = db . session . query ( DistributionCodeModel . distribution_code_id ) . filter ( DistributionCodeModel . disbursement_distribution_code_id . in_ ( partner_distribution_code_ids ) ) . all ( ) corp_type_codes : List [ str ] = db . session . query ( FeeScheduleModel . corp_type_code ) . join ( DistributionCodeLinkModel , DistributionCodeLinkModel . fee_schedule_id == FeeScheduleModel . fee_schedule_id ) . filter ( DistributionCodeLinkModel . distribution_code_id . in_ ( fee_distribution_codes ) ) . all ( ) return db . session . query ( CorpTypeModel ) . filter ( CorpTypeModel . code . in_ ( corp_type_codes ) ) . all ( )
short_docstring: Return partners by batch type.
short_docstring_tokens: Return partners by batch type .
comment: """Return partners by batch type."""$SEP$# CREDIT : Ministry GL code -> disbursement_distribution_code_id on distribution_codes table$SEP$# DEBIT : BC Registry GL Code -> distribution_code on fee_schedule, starts with 112$SEP$# 112$SEP$# Rule for GA. Credit is 112 and debit is 112.$SEP$# Rule for GI. Debit is 112 and credit is not 112.$SEP$# Find all distribution codes who have these partner distribution codes as disbursement.