def nextDayTasks(rT): rT.setCount() rT.counter -= 1 sT = rT.subTask + 1 today = datetime.datetime.today() current = datetime.datetime(today.year, today.month, today.day, rT.startDate.hour) targetDate = current + relativedelta(months=+1) nextDueDate = (targetDate) if ((rT.startDate + relativedelta(months=+1)) == targetDate): tempCount = 1 else: tempCount = 0 while (tempCount > 0): taskNew = Task(rT.taskID, rT.clientName, rT.taskName, rT.catSkillID, rT.startDate, rT.endDate, rT.freqType, rT.frequency, rT.totalTime, rT.status, rT.SLA, rT.specialNotes, rT.counter, rT.subTask) taskNew.startDate = nextDueDate nextDueDate += relativedelta(months=+1) tempCount -= 1 rT.counter -= 1 taskNew.subTask = sT sT += 1 taskNew.count = rT.counter taskList.append(taskNew)
def nextDayTasks(rT): rT.setCount() rT.counter -= 1 sT = rT.subTask + 1 today = datetime.datetime.today() current = datetime.datetime(today.year, today.month, today.day) targetDate = (current + timedelta(days=29)) nextDueDate = (targetDate + timedelta(hours=rT.frequency)) tempCount = adjCount(rT) while (tempCount > 0): taskNew = Task(rT.taskID, rT.clientName, rT.taskName, rT.catSkillID, rT.startDate, rT.endDate, rT.freqType, rT.frequency, rT.totalTime, rT.status, rT.SLA, rT.specialNotes, rT.counter, rT.subTask) if ((nextDueDate > (targetDate + timedelta(days=1))) or (nextDueDate > rT.endDate)): tempCount = 0 else: taskNew.startDate = nextDueDate nextDueDate += timedelta(hours=rT.frequency) tempCount -= 1 rT.counter -= 1 taskNew.subTask = sT sT += 1 taskNew.count = rT.counter taskList.append(taskNew)
def nextDayTasks(rT): rT.setCount() rT.counter -= 1 sT = rT.subTask + 1 today = datetime.datetime.today() current = datetime.datetime(today.year, today.month, today.day, rT.startDate.hour) targetDate = (current + timedelta(days=29)) nextDueDate = (targetDate) dateDiff = nextDueDate - rT.startDate #print dateDiff if (dateDiff.days % 7) == 0: tempCount = 1 else: tempCount = 0 while (tempCount > 0): taskNew = Task(rT.taskID, rT.clientName, rT.taskName, rT.catSkillID, rT.startDate, rT.endDate, rT.freqType, rT.frequency, rT.startTime, rT.stopTime, rT.totalTime, rT.status, rT.SLA, rT.specialNotes, rT.counter, rT.subTask) taskNew.startDate = nextDueDate nextDueDate += timedelta(days=rT.frequency) tempCount -= 1 rT.counter -= 1 taskNew.subTask = sT sT += 1 taskNew.count = rT.counter taskList.append(taskNew)
def handleCompTask(uID, tID, cN, tN, csID, sD, eD, fT, f, totT, stat, SLA, spN, c, sT, r): db = mysql.connector.connect(user='******', password='******', host='10.0.51.21', database='SOC_Portal') cur = db.cursor(buffered=True) rea = r rT = Task(tID, cN, tN, csID, sD, eD, fT, f, totT, stat, SLA, spN, c, sT) #PUSH COMPLETED TASK TO PAST TASKS DB insertTask = ( "INSERT INTO PastTasks " "(taskID, clientName, taskName, catSkillID, userID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask, reason) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" ) taskData = (rT.taskID, rT.clientName, rT.taskName, rT.catSkillID, uID, rT.startDate, rT.endDate, rT.freqType, rT.frequency, rT.totalTime, rT.status, rT.SLA, rT.specialNotes, rT.counter, rT.subTask, rea) #print (insertTask.format(taskData)) cur.execute(insertTask, taskData) #REMOVE COMPLETED TASK FROM UPCOMING TASK DB deleteTask = ("DELETE FROM UpcomingTasks WHERE taskID = " + str(rT.taskID) + "") #print deleteTask cur.execute(deleteTask) db.commit() cur.close() db.close() return "DONE"
def nextDayTasks(rT): rT.setCount() targetDate = (datetime.datetime(2018,04,03) + timedelta(days=29)) nextDueDate = (targetDate + timedelta(minutes=rT.freq)) tempCount = adjCount(rT) while (tempCount > 0): taskNew = Task(rT.taskName, rT.startDate, rT.endDate, rT.freqType, rT.freq, rT.count) if ((nextDueDate > (targetDate + timedelta(days=1))) or (nextDueDate > rT.endDate)): tempCount = 0 else: taskNew.startDate = nextDueDate nextDueDate += timedelta(minutes=rT.freq) tempCount -= 1 rT.count -= 1 taskNew.count = rT.count tNStr = taskNew.display() #print tNStr outfile.write((str(tNStr))+"\n")
def taskIntake(cN, tN, csID, sD, eD, fT, f): db = mysql.connector.connect(user='******', password='******', host='10.0.51.21', database='SOC_Portal') cur = db.cursor(buffered=True) #WHERE INITIAL TASK VALUES WILL BE SET iTask = Task(0, cN, tN, csID, sD, eD, fT, f, "0", "NEW", "", "", 0, 0) #INSERT THE FIRST TASK insertTask = ( "INSERT INTO UpcomingTasks " "(clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)") taskData = (iTask.clientName, iTask.taskName, iTask.catSkillID, iTask.startDate, iTask.endDate, iTask.freqType, iTask.frequency, iTask.totalTime, iTask.status, iTask.SLA, iTask.specialNotes, iTask.counter, iTask.subTask) cur.execute(insertTask, taskData) db.commit() #SELECT AND UPDATE NEW TASKS 29 DAYS OUT q2 = ("SELECT * FROM UpcomingTasks WHERE taskName = '" + iTask.taskName + "'") cur.execute(q2) for (taskID, clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) in cur: tList = NewTaskRecurring.main(taskID, clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) for item in tList: if (item.freqType != "Monthly"): insertTask = ( "INSERT INTO UpcomingTasks " "(clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" ) taskData = (item.clientName, item.taskName, item.catSkillID, item.startDate, item.endDate, item.freqType, item.frequency, item.totalTime, item.status, item.SLA, item.specialNotes, item.counter, item.subTask) cur.execute(insertTask, taskData) else: print("Monthly") db.commit() cur.close() db.close()
def nextDayTasks(rT): rT.setCount() today = datetime.datetime.today() current = datetime.datetime(today.year, today.month, today.day) targetDate = (current + timedelta(days=29)) nextDueDate = (targetDate + timedelta(hours=rT.freq)) tempCount = adjCount(rT) while (tempCount > 0): taskNew = Task(rT.taskName, rT.startDate, rT.endDate, rT.freqType, rT.freq, rT.count) if ((nextDueDate > (targetDate + timedelta(days=1))) or (nextDueDate > rT.endDate)): tempCount = 0 else: taskNew.startDate = nextDueDate nextDueDate += timedelta(hours=rT.freq) tempCount -= 1 rT.count -= 1 taskNew.count = rT.count tNStr = taskNew.display() outfile.write((str(tNStr)) + "\n")
def nextDayTasks(rT): rT.setCount() today = datetime.datetime.today() current = datetime.datetime(today.year, today.month, today.day, rT.startDate.hour) targetDate = current + relativedelta(months=+1) nextDueDate = (targetDate) if ((rT.startDate + relativedelta(months=+1)) == targetDate): tempCount = 1 else: tempCount = 0 while (tempCount > 0): taskNew = Task(rT.taskName, rT.startDate, rT.endDate, rT.freqType, rT.freq, rT.count) taskNew.startDate = nextDueDate nextDueDate += relativedelta(months=+1) tempCount -= 1 rT.count -= 1 taskNew.count = rT.count tNStr = taskNew.display() #print tNStr outfile.write((str(tNStr)) + "\n")
def nextDayTasks(rT): rT.setCount() today = datetime.datetime.today() current = datetime.datetime(today.year, today.month, today.day, rT.startDate.hour) targetDate = (current + timedelta(days=29)) nextDueDate = (targetDate) dateDiff = nextDueDate - rT.startDate print dateDiff if (dateDiff.days % 7) == 0: tempCount = 1 else: tempCount = 0 while (tempCount > 0): taskNew = Task(rT.taskName, rT.startDate, rT.endDate, rT.freqType, rT.freq, rT.count) taskNew.startDate = nextDueDate nextDueDate += timedelta(days=rT.freq) tempCount -= 1 rT.count -= 1 taskNew.count = rT.count tNStr = taskNew.display() outfile.write((str(tNStr)) + "\n")
nextDueDate = (targetDate + timedelta(hours=rT.freq)) tempCount = adjCount(rT) while (tempCount > 0): taskNew = Task(rT.taskName, rT.startDate, rT.endDate, rT.freqType, rT.freq, rT.count) if ((nextDueDate > (targetDate + timedelta(days=1))) or (nextDueDate > rT.endDate)): tempCount = 0 else: taskNew.startDate = nextDueDate nextDueDate += timedelta(hours=rT.freq) tempCount -= 1 rT.count -= 1 taskNew.count = rT.count tNStr = taskNew.display() outfile.write((str(tNStr)) + "\n") infile = open("ExistingTasks.txt", "r") outfile = open("NextDay.txt", "w") for line in infile: name, dt1, dt2, ft, f, c = line.split("/") yy1, mm1, dd1, hh1 = dt1.split(",") yy2, mm2, dd2, hh2 = dt2.split(",") task1 = Task(name, datetime.datetime(int(yy1), int(mm1), int(dd1), int(hh1)), datetime.datetime(int(yy2), int(mm2), int(dd2), int(hh2)), ft, int(f), int(c)) nextDayTasks(task1) #populateRecurring(task1)
def main(tID, cN, tN, csID, sD, eD, fT, f, spN, c, sT): rootTask = Task(tID, cN, tN, csID, sD, eD, fT, f, "0", "NEW", "PENDING", spN, c, sT) nextDayTasks(rootTask) return taskList
def main(tID, cN, tN, csID, sD, eD, fT, f, staT, stoT, totT, stat, SLA, spN, c, sT): rootTask = Task(tID, cN, tN, csID, sD, eD, fT, f, staT, stoT, totT, stat, SLA, spN, c, sT) nextDayTasks(rootTask) return taskList
def handleEditTask(tID, cN, tN, csID, sD, eD, fT, f): db = mysql.connector.connect(user='******', password='******', host='10.0.51.21', database='SOC_Portal') cur = db.cursor(buffered=True) oldName = "" spN = "" q1 = ("SELECT taskName, specialNotes FROM UpcomingTasks WHERE taskID = " + str(tID) + "") cur.execute(q1) for item in cur: oldName = item[0] spN = item[1] rT = Task(tID, cN, tN, csID, sD, eD, fT, f, "0", "NEW", "", spN, 0, 0) cur.execute("SET foreign_key_checks = 0") cur.execute("DELETE FROM UpcomingTasks WHERE taskName = '" + oldName + "'") db.commit() #INSERT THE FIRST TASK insertTask = ( "INSERT INTO UpcomingTasks " "(clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)") taskData = (rT.clientName, rT.taskName, rT.catSkillID, rT.startDate, rT.endDate, rT.freqType, rT.frequency, rT.totalTime, rT.status, rT.SLA, rT.specialNotes, rT.counter, rT.subTask) cur.execute(insertTask, taskData) #SELECT AND UPDATE NEW TASKS 29 DAYS OUT q2 = ("SELECT * FROM UpcomingTasks WHERE taskName = '" + rT.taskName + "'") cur.execute(q2) for (taskID, clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) in cur: tList = NewTaskRecurring.main(taskID, clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) for item in tList: if (item.freqType != "Monthly"): insertTask = ( "INSERT INTO UpcomingTasks " "(clientName, taskName, catSkillID, startDate, endDate, freqType, frequency, totalTime, status, SLA, specialNotes, counter, subTask) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" ) taskData = (item.clientName, item.taskName, item.catSkillID, item.startDate, item.endDate, item.freqType, item.frequency, item.totalTime, item.status, item.SLA, item.specialNotes, item.counter, item.subTask) cur.execute(insertTask, taskData) else: print("Monthly") cur.execute("SET foreign_key_checks = 1") db.commit() cur.close() db.close() return "DONE"