def checkDuplicates(self): # info is the events already in the google cal google = self.info portal = self.portalInfo dup = [] for a, b in enumerate(portal): dupe = False for c, d in enumerate(google): self.tempGoogle = google[d] self.tempPortal = portal[b] # checks if there are any duplicates if str(self.tempPortal["assignmentId"]) in str( self.tempGoogle["summary"]): ''' we're checking if the assignment has been rescheduled for tempPortal check: due and DueTime for tempGoogle check: start[DateTime] format: 2020-04-21T02:00:00-04:00 ''' print("temp portal", self.tempPortal) print("summary", self.tempGoogle) #todo: reschedule events # if returns that is has been rescheduled # if dateDict.isResched(self.tempPortal["due"],self.tempPortal["dueTime"], # self.tempGoogle["start"]["dateTime"]): # delete the event in the google calendat then put it back in at the correct time thats been # pulled from the portal # colorify.prRed("This event has been rescheduled") dupe = True dup.append(self.tempPortal["assignmentId"]) colorify.prRed("--- DUPLICATE DETECTED ---") print("portal event: ", self.tempPortal["assignmentId"], " - ", self.tempPortal["entityTitle"]) print("google event", self.tempGoogle["summary"]) break if len(google) == 0: colorify.prGreen("DEBUG: No Events In Google Found") self.tempPortal = portal[b] # calling prepare event to add it to the google calendar self.prepareEvent() elif dupe is False: self.tempPortal = portal[b] # calling prepare event to add it to the google calendar self.prepareEvent()
def isLate(dateString,id): month,day,year = dateSlashes(dateString) assignment = datetime(int(year),int(month),int(day)) current = datetime.now() # if assignment is due in the future or due same day as ran if assignment > current or assignment == current: colorify.prGreen("---- Not Late ----") print("ID: ", id) print("Cal: Assignment Date (mm,dd,yyyy): ",month,"-",day,"-",year) return False else: colorify.prRed("---- Late ----") print("ID: ", id) print("Cal: Assignment Date (mm,dd,yyyy): ",month,"-",day,"-",year) return True
def assignIsLate(dateString,id): total = re.search("[0-9]{4}-[0-9]{2}-[0-9]{2}",dateString).group() year = re.search("[0-9]{4}",str(total)).group() month = re.search("-[0-9]{2}-",str(total)) month = re.search("[0-9][0-9]",str(month)).group() day = re.search("-[0-9][0-9]T",dateString).group().strip("T").strip("-") assignment = datetime(int(year), int(month), int(day)) current = datetime.now() # if assignment is due in the future or due same day as ran if assignment > current or assignment == current: colorify.prGreen("---- Not Late ----") print("assignment ID: ",id) print("Assign: Assignment Date (mm,dd,yyyy): ", month, "-", day, "-", year) return False else: colorify.prRed("---- Late ----") print("assignment ID: ",id) print("Assign: Assignment Date (mm,dd,yyyy): ", month, "-", day, "-", year) return True
"COMSC.440.01-20/SP LangTranslation/Compiler Dsgn", "PHYS.330.01-20/SP Intro Phys Oceanography" ] start_time = time.time() jason = main(classes) jason.permissive_json_loads() t1 = threading.Thread(target=jason.getCal()) t2 = threading.Thread(target=jason.getAssign()) t1.start() t2.start() t1.join() t2.join() portal = combineJson.start(jason.contents, jason.cal) inter = integration(portal) integration.creds(inter) integration.Getcalendar(inter) integration.checkDuplicates(inter) end_time = time.time() time_lapsed = end_time - start_time m = "Classes detected: " + str(jason.fetchedClasses) colorify.prGreen(m) m = "TIME LAPSED: " + str(time_lapsed) + " s" colorify.prRed(m)