fix:指摘事項修正
This commit is contained in:
parent
5287659c8c
commit
5b642bbc48
@ -414,13 +414,14 @@ class ComDrMapper(UltmarcTableMapper):
|
||||
# 西暦の取得
|
||||
|
||||
# 生年月日(西暦)
|
||||
western_year = 0
|
||||
western_year: str = ""
|
||||
if self.record.birthday_era != "@" and len(self.record.birthday_era) > 0 and len(self.record.birthday_year) > 0:
|
||||
self.query_parameter['era_cd'] = self.record.birthday_era
|
||||
record_year = self.db.execute_select(self.YEAR_GET_QUERY, self.query_parameter)
|
||||
western_year = int(record_year[0]['year']) + int(self.record.birthday_year)
|
||||
western_year = str(int(record_year[0]['year']) + int(self.record.birthday_year))
|
||||
|
||||
self.__set_birthday(western_year)
|
||||
# 誕生日の設定
|
||||
self.query_parameter['birth_day'] = self.__set_birthday(western_year)
|
||||
|
||||
# 開業年(西暦)
|
||||
if self.record.pract_yearera != "@" and len(self.record.pract_yearera) > 0 and len(self.record.pract_year) > 0:
|
||||
@ -442,19 +443,19 @@ class ComDrMapper(UltmarcTableMapper):
|
||||
|
||||
return
|
||||
|
||||
def __set_birthday(self, western_year):
|
||||
def __set_birthday(self, western_year: str = ""):
|
||||
# 誕生日を設定
|
||||
|
||||
if western_year != 0 and len(self.record.birthday_month) > 0 and len(self.record.birthday_day) > 0:
|
||||
# 全ての項目が入っている場合
|
||||
self.query_parameter['birth_day'] = ''.join([str(western_year), self.record.birthday_month, self.record.birthday_day])
|
||||
return
|
||||
# 年(西暦)、月、日を連結
|
||||
birth_day = ''.join([western_year, self.record.birthday_month, self.record.birthday_day])
|
||||
|
||||
if western_year == 0 and len(self.record.birthday_month) > 0 and len(self.record.birthday_day) > 0:
|
||||
# 生年月日の年が空の場合は、誕生日はスペース4個と月日
|
||||
self.query_parameter['birth_day'] = ' ' + self.record.birthday_month + self.record.birthday_day
|
||||
return
|
||||
# 年(西暦)、月、日が全て揃っている場合
|
||||
if len(birth_day) == 8:
|
||||
return birth_day
|
||||
|
||||
# 月か日が空の場合は、誕生日は空
|
||||
self.query_parameter['birth_day'] = ''
|
||||
return
|
||||
# 西暦が空の場合、先頭に半角スペース4つで連結
|
||||
if len(western_year) == 0 and len(self.record.birthday_month) > 0 and len(self.record.birthday_day) > 0:
|
||||
return f' {self.record.birthday_month}{self.record.birthday_day}'
|
||||
|
||||
# 月日も空の場合、生年月日は空
|
||||
return ''
|
||||
|
||||
@ -28,13 +28,13 @@ class TestComDrMapper:
|
||||
# setup
|
||||
self.db = database
|
||||
self.db.connect()
|
||||
self.db.begin()
|
||||
# self.db.begin()
|
||||
|
||||
# testing
|
||||
yield
|
||||
|
||||
# teardown
|
||||
self.db.rollback()
|
||||
# self.db.rollback()
|
||||
self.db.disconnect()
|
||||
|
||||
def test_insert_record(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user