Esempio n. 1
0
    def run(self):
        while True:
            time.sleep(1800)

            courseList = select_end_course_for_chart()

            if len(courseList) is not 0:
                for course in courseList:
                    wb, sheet, style = self.setChart(course)
                    userInfo = select_user_in_end_course(course.index)

                    if len(userInfo) is 0:
                        wb.save()
                        continue

                    posY = 2
                    for info in userInfo:
                        sheet.write(posY, 0, info.name, style)
                        sheet.write(posY, 1, info.firstLogin, style)
                        sheet.write(posY, 2, info.lastLogin, style)
                        sheet.write(posY, 3, info.lastLogout, style)

                        posX = 4
                        procList = info.individualInfomation.split('*')

                        for proc in procList:
                            sheet.write(posY, posX, proc, style)
                            posX += 1

                        posY += 1

                    wb.save()
                    send_chart_with_mail.delay(select_master_email(course.testName)[0]) #path 추가
Esempio n. 2
0
 def send_email_handler(self, data):
     try:
         info = data.split(";")
         userIndex = int(info[0])
         programInfo = info[2].split(',')
         userInfo = select_user_info(userIndex)
         mailAddress = select_master_email(programInfo[2])[0]
         programName = select_ban_program_name(programInfo[0])[0]
         send_mail.delay(userInfo[0], userInfo[1], programName, programInfo[1], mailAddress)
     except Exception as e:
         print(e)
     return