def show_user_datas(cls): super().describe_current_stage('사용자 정보 조회') users = reader.read_all_users() all_deposits = reader.read_all_accounts(account_type='Deposits') all_savings = reader.read_all_accounts() for info in users.values(): deposits, savings = [], [] # 적금, 예금 분리 for account_num in info['accounts']: if int(account_num[0]) < 5: # 예금 deposits.append(account_num) else: # 적금 savings.append(account_num) # 출력 print(f"{info['name']} / {info['sign_up_date']}", end=' / ') for deposit in deposits: balance = all_deposits[deposit]['balance'] print(f"{deposit} / {balance}", end=' / ') for saving in savings: balance = all_savings[saving]['balance'] print(f"{saving} / {balance}", end=' / ') print() print(f"총 {len(users)} 명 입니다.\n\n") print('아무키나 입력하세요\n') input()
def integrity_check(self) : # 무결성 검사 errorCheck = True # 에러가 있으면 False로 변경 # 홈 경로에 데이터 파일이 있는지 확인 # 없으면 경고문구 출력, 빈 데이터 파일 생성 # 있으면 다음 단계 user_file_check = fm.make_users() history_file_check = fm.make_history() account_file_check = fm.make_accounts() if user_file_check and history_file_check and account_file_check : pass else : bmv.file_error_output() # 데이터 파일 확인 # accounts.json, history.json, users.json # 예금, 적금 계좌번호 중복확인 # 이름, 비밀번호 중복 확인 # 문법 규칙 확인 ################## keys가 자동으로 중복을 처리해버리는 문제 ## json 자체에서 중복이 오류 처리됨 try : users_data = fr.read_all_users() if len(set(users_data.keys())) == len(users_data.keys()) : pass else : errorCheck = False history_data = fr.read_all_transactions() if len(set(history_data.keys())) == len(history_data.keys()) : pass else : errorCheck = False savings_data = fr.read_all_accounts() if len(set(savings_data.keys())) == len(savings_data.keys()) : pass else : errorCheck = False deposits_data = fr.read_all_accounts_in_deposit() if len(set(deposits_data.keys())) == len(deposits_data.keys()) : pass else : errorCheck = False except : bmv.error_output() errorCheck = False # 오류가 있으면 종료 return errorCheck