diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index 9b26e0b..7e0eb7b 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -93,71 +93,68 @@ def chkData(data): if 'pass_why' in res1: key16 = res1['pass_why'] res1['pass_why'] = pass_why_dict.get(key16, '') - if 'work_list' in res1: - work_list = res1['work_list'] - if work_list: - work_list = [json.loads(i) for i in work_list] - if isinstance(work_list[0], str): - work_list = [eval(i) for i in work_list] - if len(work_list) > 1: - true_index = 0 - for index, i in enumerate(work_list): - if index == 0: - continue - split_str1 = '' - split_str2 = '' - if '-' in i['time']: - split_str1 = '-' - if '-' in work_list[true_index]['time']: - split_str2 = '-' - if '–' in i['time']: - split_str1 = '–' - if '–' in work_list[true_index]['time']: - split_str2 = '–' - if '―' in i['time']: - split_str1 = '―' - if '―' in work_list[true_index]['time']: - split_str2 = '―' - if '—' in i['time']: - split_str1 = '—' - if '—' in work_list[true_index]['time']: - split_str2 = '—' - try: + try: + if 'work_list' in res1: + work_list = res1['work_list'] + if work_list: + work_list = [json.loads(i) for i in work_list] + if isinstance(work_list[0], str): + work_list = [eval(i) for i in work_list] + if len(work_list) > 1: + true_index = 0 + for index, i in enumerate(work_list): + if index == 0: + continue + split_str1 = '' + split_str2 = '' + if '-' in i['time']: + split_str1 = '-' + if '-' in work_list[true_index]['time']: + split_str2 = '-' + if '–' in i['time']: + split_str1 = '–' + if '–' in work_list[true_index]['time']: + split_str2 = '–' + if '―' in i['time']: + split_str1 = '―' + if '―' in work_list[true_index]['time']: + split_str2 = '―' + if '—' in i['time']: + split_str1 = '—' + if '—' in work_list[true_index]['time']: + split_str2 = '—' if int(i['time'].split(split_str1)[0].replace('.', '').replace('/', '')) > int( work_list[true_index]['time'].split(split_str2)[0].replace('.', '').replace('/', '')): true_index = index - except: - true_index = index - # if int(i['time'].split(split_str1)[0].replace('.', '').replace('/', '')) > int( - # work_list[true_index]['time'].split(split_str2)[0].replace('.', '').replace('/', '')): - # true_index = index - work_dict = work_list[true_index] - work_list = [work_dict] - bast_index = 0 - bast_time = 0 - for index, i in enumerate(work_list): - time = i.get('time' '').replace('.', '/') - if time: - split_str3 = '' - if '-' in time: - split_str3 = '-' - if '–' in time: - split_str3 = '–' - if '―' in time: - split_str3 = '―' - if '—' in time: - split_str3 = '—' - if time.split(split_str3)[-1].split('/')[0].strip().isdigit(): - chk_time = int(time.split('-')[-1].split('/')[0]) - else: - chk_time = int(datetime.now().year) - if chk_time > bast_time: - bast_time = chk_time - bast_index = index - res1['firm'] = work_list[bast_index]['company_name'] - else: - work_list = [] - res1['work_list'] = work_list + work_dict = work_list[true_index] + work_list = [work_dict] + bast_index = 0 + bast_time = 0 + for index, i in enumerate(work_list): + time = i.get('time' '').replace('.', '/') + if time: + split_str3 = '' + if '-' in time: + split_str3 = '-' + if '–' in time: + split_str3 = '–' + if '―' in time: + split_str3 = '―' + if '—' in time: + split_str3 = '—' + if time.split(split_str3)[-1].split('/')[0].strip().isdigit(): + chk_time = int(time.split('-')[-1].split('/')[0]) + else: + chk_time = int(datetime.now().year) + if chk_time > bast_time: + bast_time = chk_time + bast_index = index + res1['firm'] = work_list[bast_index]['company_name'] + else: + work_list = [] + res1['work_list'] = work_list + except: + res1['work_list'] = [] if 'project_undergo' in res1: project_undergo = res1['project_undergo'] if project_undergo: