def __init__(self, pid, event_list):
     self.pid = pid
     self.place = place_name(pid)
     self.province_id = pid_province(pid)
     event_list.sort(key=lambda x: x.begin_time)
     Po.mc_bind(event_list, 'po', 'id')
     self.event_list = event_list
Beispiel #2
0
 def __init__(self, pid, event_list):
     self.pid = pid
     self.place = place_name(pid)
     self.province_id = pid_province(pid)
     event_list.sort(key=lambda x: x.begin_time)
     Po.mc_bind(event_list, 'po', 'id')
     self.event_list = event_list
def city_event_weight(o, pid):
    o_pid = o.pid
    if pid:
        if o_pid == pid:
            return 200
        elif o.province_id == pid_province(pid):
            return 100
    return PID_WEIGHT_DICT.get(o_pid, 0)
Beispiel #4
0
def city_event_weight(o, pid):
    o_pid = o.pid
    if pid:
        if o_pid == pid:
            return 200
        elif o.province_id == pid_province(pid):
            return 100
    return PID_WEIGHT_DICT.get(o_pid, 0)
def event_city_info(event_city_list, pid):
    event_city_list.sort(reverse=True, key=lambda x: city_event_weight(x, pid))
    count = 0
    place = ''
    if pid:
        first = event_city_list[0]
        if first.pid == pid:
            count = len(first.event_list)
            place = PID2NAME[pid]
        else:
            province_id = pid_province(pid)
            #print place_name(province_id)
            li = filter(lambda x: x.province_id == province_id, event_city_list)
            if li:
                count = sum([len(i.event_list) for i in li])
                place = place_name(province_id)

    return event_city_list, count, place
Beispiel #6
0
def event_city_info(event_city_list, pid):
    event_city_list.sort(reverse=True, key=lambda x: city_event_weight(x, pid))
    count = 0
    place = ''
    if pid:
        first = event_city_list[0]
        if first.pid == pid:
            count = len(first.event_list)
            place = PID2NAME[pid]
        else:
            province_id = pid_province(pid)
            #print place_name(province_id)
            li = filter(lambda x: x.province_id == province_id,
                        event_city_list)
            if li:
                count = sum([len(i.event_list) for i in li])
                place = place_name(province_id)

    return event_city_list, count, place