Esempio n. 1
0
def get_processing_record(restaurant_id):
    processing_records = record_base.get_processing_records(restaurant_id)
    users = user_base.mget_users([record.process_user_id for record in processing_records])

    response_pack = []
    attrs_to_pack = ["process_user_id", "status_to", "comment", "created_at"]
    for index, record in enumerate(processing_records):
        record_pack = {"process_user_name": users[index].username}
        for name in attrs_to_pack:
            record_pack[name] = getattr(record, name)
        response_pack.append(record_pack)

    return response_pack
Esempio n. 2
0
def get_processing_record(restaurant_id):
    processing_records = record_base\
        .get_processing_records(restaurant_id)
    users = user_base.mget_users(
        [record.process_user_id for record in processing_records]
    )

    response_pack = []
    attrs_to_pack = ['process_user_id', 'status_to', 'comment',
                     'created_at']
    for index, record in enumerate(processing_records):
        record_pack = {'process_user_name': users[index].username}
        for name in attrs_to_pack:
            record_pack[name] = getattr(record, name)
        response_pack.append(record_pack)

    return response_pack
Esempio n. 3
0
def get_processing_record(rst_id, bankcard_id):
    arg_spec = {
        "limit": Arg(int, allow_missing=True),
    }
    args = args_parser.parse(arg_spec)
    limit = args.get("limit", DEFAULT_RECORD_LIMIT)
    processing_record_list = bankcard_base \
        .query_processing_record(rst_id, bankcard_id, limit)
    if not processing_record_list:
        return []
    process_user_ids = []
    for m in processing_record_list:
        process_user_ids.append(m.process_user_id)
    process_user_list = user_base.mget_users(process_user_ids)
    process_user_dict = {user.id: user.username for user in process_user_list}
    processing_record_list_new = []
    for processing_record in processing_record_list:
        pr_dict = model2dict(processing_record)
        pr_dict['process_user_username'] = \
            process_user_dict.get(pr_dict['process_user_id'])
        processing_record_list_new.append(pr_dict)
    return processing_record_list_new
Esempio n. 4
0
def get_processing_record(rst_id, bankcard_id):
    arg_spec = {
        "limit": Arg(int, allow_missing=True),
    }
    args = args_parser.parse(arg_spec)
    limit = args.get("limit", DEFAULT_RECORD_LIMIT)
    processing_record_list = bankcard_base \
        .query_processing_record(rst_id, bankcard_id, limit)
    if not processing_record_list:
        return []
    process_user_ids = []
    for m in processing_record_list:
        process_user_ids.append(m.process_user_id)
    process_user_list = user_base.mget_users(process_user_ids)
    process_user_dict = {user.id: user.username for user in process_user_list}
    processing_record_list_new = []
    for processing_record in processing_record_list:
        pr_dict = model2dict(processing_record)
        pr_dict['process_user_username'] = \
            process_user_dict.get(pr_dict['process_user_id'])
        processing_record_list_new.append(pr_dict)
    return processing_record_list_new