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
Exemple #2
0
    def __show_saving_history_result(cls, user, start_date, end_date):
        super().Ais('<' + user.name + '님의 내역>\n')

        transactions = reader.read_all_transactions()
        if user.savings in transactions.keys():
            for history in transactions[user.savings]:
                if int(history['date']) > int(start_date) and int(
                        history['date']) < int(end_date):
                    print(
                        f"{history['from']} / {history['to']} / {history['date']} / {history['time']} / {history['amount']}\n"
                    )
            super().Ais('마지막 페이지')
            print('아무키나 입력하세요....\n\n')
            input()
        else:
            print('내역이 없습니다.\n\n')
Exemple #3
0
    def show_transaction_datas(cls):
        super().describe_current_stage('전체 내역 조회')

        transactions = reader.read_all_transactions()
        transactions_without_redundancy = []
        for one_account_history in transactions.values():
            for history in one_account_history:
                stamp = history['date'] + history['time']  # exclude redundancy
                if stamp not in transactions_without_redundancy:
                    transactions_without_redundancy.append(stamp)
                    print(
                        f"{history['from']} / {history['to']} / {history['date']} / {history['time']} / {history['amount']}"
                    )

        print(f"총 {len(transactions_without_redundancy)} 건 입니다.")

        print('아무키나 입력하세요.....\n')
        input()
Exemple #4
0
 def __show_deposit_history_result(cls, user, start_date, end_date):
     super().Ais(user.name + '님의 내역')
     #10개씩 출력 --> 아무키나 입력시 다음 10개로
     transactions = reader.read_all_transactions()
     if user.deposits in transactions.keys():
         cnt = -1
         for history in transactions[user.deposits]:
             cnt = cnt + 1
             if int(history['date']) >= int(start_date) and int(
                     history['date']) <= int(end_date):
                 print(
                     f"{history['from']} / {history['to']} / {history['date']} / {history['time']} / {history['amount']}"
                 )
                 if cnt == 10:
                     cnt = 0
                     input()
                     continue
                 else:
                     pass
         super().Ais('마지막 페이지')
     else:
         print('내역이 없습니다.')