Beispiel #1
0
Datei: task.py Projekt: 42qu/ios
def task_apply(self, access_token, task_id, txt='', uid=None):
    print 'task_apply %s' % task_id
    po = po_task_get(task_id)
    if po:
        po.task.apply(uid, txt)
        return True
    else:
        return False
Beispiel #2
0
Datei: task.py Projekt: 42qu/ios
def task_list(self, access_token, type, filter, last_id, num, uid=None):
    print 'task_list'
    lst = []
    if type == TaskListType.All:
        if filter.sort == TaskSort.ByTime:
            po_list = po_task_id_list_order_by_time
        else:
            po_list = po_task_id_list_order_by_count
        lst =  po_list(filter.tag_id, filter.city_id, filter.state, last_id, num)

    ret = []

    for i in lst:
        po = po_task_get(i)
        if po:
            baisc = _po_task_to_task_basic(po)
            ret.append(baisc)

    return ret
Beispiel #3
0
Datei: task.py Projekt: 42qu/ios
def task_ext_get(self, access_token, id, ext_only=True):
    print 'task_get %s' % id
    p = po_task_get(id)
    if not p:
        return
    t = p.task

    s = TASK_APPLY_STATE
    _d = dict()
    for i in (s.APPLY, s.ACCEPT):
        _d[i] = list(task_apply_user_id_list(id, i))

    ext = TaskExt(
            applied = _d[s.APPLY],
            invited = [],
            accepted = _d[s.ACCEPT],
        )

    return ext
Beispiel #4
0
Datei: task.py Projekt: 42qu/ios
def my_task_reject(self, access_token, task_id, user_id, txt='', uid=None):
    po = po_task_get(task_id)
    if po and po.can_admin(uid):
        po.task.reject(user_id, txt)
Beispiel #5
0
Datei: task.py Projekt: 42qu/ios
def my_task_accept(self, access_token, task_id, user_id,  uid=None):
    po = po_task_get(task_id)
    if po and po.can_admin(uid):
        po.task.accept(user_id)