예제 #1
0
    def finance_stage_distribution_analyze(cls, jobs):
        """分析招聘该职位的公司的融资分布情况"""
        company_ids = [job.company_id for job in jobs]
        companys = CompanyController.list(ids=company_ids)

        reversed_finance_stage_dict_dict = reverse_dict(
            constants.FINANCE_STAGE_DICT)
        # 特定排序的融资dict
        finance_stage_distribution = {
            '成熟型(不需要融资)': 0,
            '成长型(不需要融资)': 0,
            '初创型(不需要融资)': 0,
            '上市公司': 0,
            '成熟型(D轮及以上)': 0,
            '成熟型(C轮)': 0,
            '成长型(B轮)': 0,
            '成长型(A轮)': 0,
            '初创型(天使轮)': 0,
            '初创型(未融资)': 0,
        }
        for company in companys:
            finance_stage = reversed_finance_stage_dict_dict[
                company.finance_stage]
            if finance_stage in finance_stage_distribution:
                finance_stage_distribution[
                    finance_stage] = finance_stage_distribution[
                        finance_stage] + 1
        return finance_stage_distribution
예제 #2
0
 def test_reverse_dict(self):
     test_dict = {
         'one': 1,
         'two': 'three',
         3: 2,
         4: 'four',
     }
     new_dict = reverse_dict(old_dict=test_dict)
     self.assertEqual(new_dict[1], 'one')
     self.assertEqual(new_dict['three'], 'two')
     self.assertEqual(new_dict[2], 3)
     self.assertEqual(new_dict['four'], 4)
예제 #3
0
 def educations_request_analyze(cls, jobs):
     """分析职位的学历要求"""
     reversed_education_request_dict = reverse_dict(
         constants.EDUCATION_REQUEST_DICT)
     educations_request_counter = {}
     for job in jobs:
         education_request = reversed_education_request_dict[job.education]
         if education_request in educations_request_counter:
             educations_request_counter[education_request] += 1
         else:
             educations_request_counter[education_request] = 1
     return educations_request_counter
예제 #4
0
def work_years_request_analyze(jobs):
    """分析职位的工作年限要求"""
    reversed_word_years_request_dict = reverse_dict(
        constants.WORK_YEARS_REQUEST_DICT)
    work_years_request_counter = {}
    for job in jobs:
        work_years_request = reversed_word_years_request_dict[job.work_year]
        if work_years_request in work_years_request_counter:
            work_years_request_counter[work_years_request] += 1
        else:
            work_years_request_counter[work_years_request] = 1
    return work_years_request_counter