Exemple #1
0
def buildStudentDB():

    studentNoList = []
    # insert student info using 출석부 file ==> student no, name
    for no, name in readExcelStudentInfo(excelFilePath):
        LectureDB.insertStudentInfo(no, name, None) # katalk ID = None, not yet assigned
        studentNoList.append(no)

    # read katalk chat, extract matching katalk ID, name, no, update student info DB
    for katalkID, name, no in readKatalkUserInfo(chatFilePath):
        if LectureDB.findStudentInfo(no=no) is None:
            print('Error:', katalkID + '의 .user 정보작성에 오류가 있음. - 출석부에 학번', no, ' 존재하지 않음.')
            continue
        if LectureDB.findStudentInfo(name=name) is None:
            print('Error:', katalkID + '의 .user 정보작성에 오류가 있음. - 출석부에 이름', name, ' 존재하지 않음.')
            continue
        LectureDB.updateStudentInfo(no, name, katalkID)
        # print(no, name, katalkID)


    # check integrity of student info DB
    for no in studentNoList:
        info = LectureDB.findStudentInfo(no=no)
        # print(info)
        if info['katalkID'] is None:
            print('Error: ' , info['name']+'의 .user 정보작성에 오류가 있음.')