tod_uniq, hab_uniq = main.get_uniqs(matchDict, tod_tasks, hab_tasks) #Okay, so what if there are two matched tasks in the two uniq lists that really should be paired? matchDict = main.check_newMatches(matchDict, tod_uniq, hab_uniq) tod_uniq = [] hab_uniq = [] tod_uniq, hab_uniq = main.get_uniqs(matchDict, tod_tasks, hab_tasks) #Here anything new in tod gets added to hab for tod in tod_uniq: tid = tod.id if tod.recurring == "Yes": new_hab = main.make_daily_from_tod(tod) else: new_hab = main.make_hab_from_tod(tod) newDict = new_hab.task_dict r = main.write_hab_task(newDict) print("Added hab to %s!" % tod.name) print(r) if r.ok == False: fin_hab = main.get_hab_fromID(tid) else: fin_hab = main.get_hab_fromID(tid) matchDict[tid] = {} matchDict[tid]['tod'] = tod matchDict[tid]['hab'] = fin_hab matchDict[tid]['recurs'] = tod.recurring if matchDict[tid]['recurs'] == 'Yes': if tod.dueToday == 'Yes': matchDict[tid]['duelast'] = 'Yes'
if tod_task.name == hab_task.name: tid = tod_task.id matchDict[tid] = {} matchDict[tid]['hab'] = hab_task matchDict[tid]['tod'] = tod_task r.append(main.add_hab_id(tid,hab_task)) tod_uniq, hab_uniq = main.get_uniqs(matchDict, tod_tasks, hab_tasks) #Now we've confirmed that we don't have any accidental duplicates and that previously sent tasks are all knocked out of the way, it's time to add copies of the individual tasks... for i in tod_uniq: if ev in i.date_string: hab = main.make_daily_from_tod(i) main.write_hab_daily(hbt, hab) else: hab = main.make_hab_from_tod(i) main.write_hab_todo(hbt,task) #I'm just assuming that all these tasks can be dumped in the inbox. See above for todoist Inbox ID code, which is located under login for task in hab_uniq: if task.category== "daily": tod_user.items.add(task.name,tod_inboxID,date_string=task.dailies_due) else: tod_user.items.add(task.name,tod_inboxID) #I also want to make sure that any tasks which are checked off AND have paired tasks agree on completion. #If one is checked complete, both should be... for t in matchDict: #make sure neither of these are used elsewhere in code print(t) if matchDict[t]['tod'].complete == 0: print("TOD INCOMPETE: %s " % (matchDict[t]['tod'].name))
if tod_task.name == hab_task.name: tid = tod_task.id matchDict[tid] = {} matchDict[tid]['hab'] = hab_task matchDict[tid]['tod'] = tod_task r.append(main.add_hab_id(tid, hab_task)) tod_uniq, hab_uniq = main.get_uniqs(matchDict, tod_tasks, hab_tasks) #Now we've confirmed that we don't have any accidental duplicates and that previously sent tasks are all knocked out of the way, it's time to add copies of the individual tasks... for i in tod_uniq: if ev in i.date_string: hab = main.make_daily_from_tod(i) main.write_hab_daily(hbt, hab) else: hab = main.make_hab_from_tod(i) main.write_hab_todo(hbt, task) #I'm just assuming that all these tasks can be dumped in the inbox. See above for todoist Inbox ID code, which is located under login for task in hab_uniq: if task.category == "daily": tod_user.items.add(task.name, tod_inboxID, date_string=task.dailies_due) else: tod_user.items.add(task.name, tod_inboxID) #I also want to make sure that any tasks which are checked off AND have paired tasks agree on completion. #If one is checked complete, both should be... for t in matchDict: #make sure neither of these are used elsewhere in code print(t)
#We'll want to just... pull all the unmatched completed tasks out of our lists of tasks. Yeah? tod_uniq, hab_uniq = main.get_uniqs(matchDict, tod_tasks, hab_tasks) #Okay, so what if there are two matched tasks in the two uniq lists that really should be paired? matchDict = main.check_newMatches(matchDict,tod_uniq,hab_uniq) tod_uniq, hab_uniq = main.get_uniqs(matchDict, tod_tasks, hab_tasks) #Here anything new in tod gets added to hab for tod in tod_uniq: tid = tod.id if tod.recurring == "Yes": new_hab = main.make_daily_from_tod(tod) else: new_hab = main.make_hab_from_tod(tod) newDict = new_hab.task_dict r = main.write_hab_task(newDict) print("Added hab to %s!" % tod.name) print(r) if r.ok == False: fin_hab = main.get_hab_fromID(tid) else: fin_hab = main.get_hab_fromID(tid) matchDict[tid] = {} matchDict[tid]['tod'] = tod matchDict[tid]['hab'] = fin_hab matchDict[tid]['recurs'] = tod.recurring #And we do the same with habs unique to tods... for hab in hab_uniq: