コード例 #1
0
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)
コード例 #2
0
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)
コード例 #3
0
    except ObjectDoesNotExist:
        return False

def matchingBibliocommonsTasks(user):
    try:
        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