feat: 単体試験不具合対応

This commit is contained in:
高木要 2023-07-21 17:06:37 +09:00
parent 68339d28a0
commit b50a43a7bd
2 changed files with 15 additions and 11 deletions

View File

@ -5,6 +5,7 @@ from io import TextIOWrapper
from datetime import datetime
from abc import ABCMeta, abstractmethod
from src.system_var import constants
from src.util.string_util import is_not_empty
from src.repositories.mst_inst_repository import MstInstRepository
from src.repositories.bu_master_cd_repository import BuMasterRepository
from src.repositories.emp_master_repository import EmpMasterRepository
@ -121,11 +122,13 @@ class MasterMainteCSVItem(metaclass=ABCMeta):
end_date_col_name: str) -> tuple[list[str], datetime, datetime]:
error_list = []
if start_date is not None:
start_date_time: datetime = None
end_date_time: datetime = None
if is_not_empty(start_date):
(result, start_date_time) = self.__parse_str_to_date(start_date)
if result is False:
error_list.append(f'{self.line_num}行目の{start_date_col_name}が実在しない日付になっています。')
if end_date is not None:
if is_not_empty(end_date):
(result, end_date_time) = self.__parse_str_to_date(end_date)
if result is False:
error_list.append(f'{self.line_num}行目の{end_date_col_name}が実在しない日付になっています。')
@ -252,7 +255,7 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
def check_inst_cd_exists(self) -> list[str]:
error_list = []
if super().is_exist_inst_cd() is False:
if is_not_empty(self.inst_cd) and super().is_exist_inst_cd() is False:
error_list.append(
f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_INST_CD_COL_NO]}\
は施設マスタに存在しないコードです')
@ -260,7 +263,7 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
def check_emp_cd_exists(self) -> list[str]:
error_list = []
if self.start_date is None or len(self.start_date) == 0:
if not self.start_date or not self.emp_cd:
return error_list
if super().is_exist_emp_cd(self.start_date) is True:
@ -271,7 +274,7 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
def check_bu_cd_exists(self) -> list[str]:
error_list = []
if super().is_exist_bu_cd() is False:
if is_not_empty(self.bu_cd) and super().is_exist_bu_cd() is False:
error_list.append(f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_BU_CD_COL_NO]}\
はビジネスユニットマスタに存在しないコードです')
return error_list
@ -283,7 +286,7 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
self.end_date,
constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_START_DATE],
constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_END_DATE])
if len(error_list) > 0 or self.start_date is None or self.end_date is None:
if len(error_list) > 0 or not self.start_date or not self.end_date:
return error_list
if start_date_time > end_date_time:
@ -411,13 +414,15 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
def check_inst_cd_exists(self) -> list[str]:
error_list = []
if super().is_exist_inst_cd() is False:
if is_not_empty(self.inst_cd) and super().is_exist_inst_cd() is False:
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_CD_COL_NO]}\
は施設マスタに存在しないコードです')
return error_list
def check_emp_cd_exists(self) -> list[str]:
error_list = []
if not self.start_date or not self.emp_cd:
return error_list
if self.comment != '追加' and self.comment != '担当者修正':
return error_list
@ -431,8 +436,7 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
"""BuCd存在チェック"""
error_list = []
if super().is_exist_bu_cd() is False:
if is_not_empty(self.bu_cd) and super().is_exist_bu_cd() is False:
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_BU_CD_COL_NO]}\
はビジネスユニットマスタに存在しないコードです')
return error_list
@ -460,7 +464,7 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
end_date,
constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO],
end_date_col_name)
if len(error_list) > 0 or start_date is None or end_date is None:
if len(error_list) > 0 or not start_date or not end_date:
return error_list
if start_date_time > end_date_time:

View File

@ -29,7 +29,7 @@
<h1>
<table class="headerTable">
<tr>
<td class="headerTdLeft"><h1>施設担当者データCSVアップロ</h1></td>
<td class="headerTdLeft"><h1>施設担当者データCSVアップロ</h1></td>
<td class="headerTdRight">
{% if mainte_csv_up.is_verified and mainte_csv_up.is_error_message_list_empty() %}
<input type="button" class="header_buttonSize" onclick="location.href='/masterMainte/instEmpCsvUL' " value="戻る">