Пример #1
0
def _move_task_beth_views(svid, dvid, tid):
    dest=core.getdoc('task-views', dvid)
    sour=core.getdoc('task-views', svid)
    _add_task_to_view(dvid, tid)
    for i in sour['path']:
        if not i in dest['path']:
            _del_task_from_view(i, tid)
    _del_task_from_view(svid, tid)
Пример #2
0
def _change_view_path(pvid, cvid, called_recursive=False):
    new_parent=core.getdoc('task-views', pvid)
    child=core.getdoc('task-views', cvid)
    old_path=child['path'][:]
    new_parent['subviews'].append(cvid)
    child['path']=new_parent['path']+[new_parent['_id']]
    core.setdoc('task-views', new_parent)
    core.setdoc('task-views', child)
    if not called_recursive:
        toclean=[]
        for i in old_path:
            if not i in new_parent['path']:
                toclean.append(i)
        for i in child['tasks']:
            _del_task_from_views(toclean, i)
    for i in child['subviews']:
        _change_view_path(cvid, i, called_recursive=True)
Пример #3
0
def _get_view_tidlist(vid, recursive=True):
    view=core.getdoc('task-views', vid)
    tidl=view['tasks']
    if recursive:
        for subview in view['subviews']:
            for tid in _get_view_tidlist(subview):
                if not tid in tidl:
                    tidl.append(tid)
    return tidl
Пример #4
0
def finish(un, tid):#optimize it
    t=_get_task(tid)
    t['finished']=time()
    t['finisher']=un
    path=core.getview('task-views', 'tasks/getfullpath', tid, reduce=True)
    t['finish_view']=path[-1]
    _set_task(t)
    view=core.getdoc('task-views', path[-1])
    if view['_id'].split('_')[1]=="proj":
        _add_task_to_view(view['_id'], tid, dest="finished_tasks")
    _move_task_beth_cat(path[-1], un+"_arch", tid)
    return True
Пример #5
0
def _create_group(bossid, name):
    glob=core.getdoc('groups', "glob")
    glob['counter']=glob['counter']+1
    temp=__create_group_dict(bossid, name, glob['counter'])
    core.setdoc('groups', glob)
    return core.setdoc('groups', temp)
Пример #6
0
def _add_member(uid, gid):
    group=core.getdoc('groups', str(gid))
    group['members'].append(uid)
    core.setdoc('groups', group)
Пример #7
0
def _del_task_from_view(vid, tid):
    view=core.getdoc('task-views', vid)
    if tid in view['tasks']:
        view['tasks'].remove(tid)
        core.setdoc('task-views', view)
Пример #8
0
def _add_task_to_view(vid, tid, dest="tasks"):
    view=core.getdoc('task-views', vid)
    view[dest].append(tid)
    core.setdoc('task-views', view)
Пример #9
0
def _get_task(tid):
    return core.getdoc('tasks', tid)
Пример #10
0
def _upd_task_order(vid, neworder):
    newview=core.getdoc('task-views', vid)
    newview['tasks']=neworder
    core.setdoc('task-views', newview)