def matchingTimeMapTasks(user, timeMapState): tasks = getTaskResultSet(user).filter(type=TASK_TIMEMAP) activeTasks = [] otherTasks = [] for task in tasks: if timeMapMatches(task, timeMapState): action = getUserAction(user, task) if action is None: otherTasks.append(task) elif action.complete != True: activeTasks.append(task) return (activeTasks, otherTasks)
def matchingSocialTasks(user, social): tasks = getTaskResultSet(user).filter(type=TASK_SOCIAL) activeTasks = [] otherTasks = [] for task in tasks: if socialMatches(task, social): action = getUserAction(user, task) if action is None: otherTasks.append(task) elif action.complete != True: activeTasks.append(task) return (activeTasks, otherTasks)
def matchingCodeTasks(user, code): task = getTaskForCode(code) if task is None: return ([], []) action = getUserAction(user, task) if action is None: burnCode(code) return ([], [task,]) if action.complete: return ([], []) burnCode(code) return ([task,], [])
bibliolink = BibliocommonsLink.objects.get(user=user) if bibliolink.biblioid == -1: return ([], []) except ObjectDoesNotExist: return ([], []) try: content = centennial.bibliocommons.userContent(bibliolink.biblioid) except Exception, e: print e return ([], []) tasks = getTaskResultSet(user).filter(type=TASK_BIBLIOCOMMONS) activeTasks = [] otherTasks = [] for task in tasks: if bibliocommonsMatches(content, task): action = getUserAction(user, task) if action is None: otherTasks.append(task) elif action.complete != True: activeTasks.append(task) return (activeTasks, otherTasks) def bibliocommonsMatches(contentSet, task): reqs = task.getInfoReqs() for content in contentSet: skip = True for nestedContent in content['content']: if 'action' in reqs and reqs['action'].strip().lower() == nestedContent['content_type']['id'].strip().lower(): skip = False if skip: continue