async def fetch_all_feedback_resources(conn): return await r.table('feedbacks')\ .filter((fetch_latest_block_num() >= r.row['start_block_num']) & (fetch_latest_block_num() < r.row['end_block_num']))\ .map(lambda feedback: (feedback['text'] == "").branch( feedback.without('text'), feedback))\ .without('start_block_num', 'end_block_num', 'delta_id')\ .coerce_to('array').run(conn)
async def fetch_all_asset_resources(conn): return await r.table('assets')\ .filter((fetch_latest_block_num() >= r.row['start_block_num']) & (fetch_latest_block_num() < r.row['end_block_num']))\ .map(lambda asset: (asset['description'] == "").branch( asset.without('description'), asset))\ .map(lambda asset: (asset['rules'] == []).branch( asset, asset.merge(parse_rules(asset['rules']))))\ .without('start_block_num', 'end_block_num', 'delta_id')\ .coerce_to('array').run(conn)
async def fetch_all_asset_resources(conn): return await r.table('assets')\ .filter((fetch_latest_block_num() >= r.row['start_block_num']) & (fetch_latest_block_num() < r.row['end_block_num']))\ .map(lambda asset: (asset['description'] == "").branch( asset.without('description'), asset))\ .map(lambda asset: (asset['rules'] == []).branch( asset, asset.merge(parse_rules(asset['rules']))))\ .without('start_block_num', 'end_block_num', 'delta_id')\ .coerce_to('array').run(conn)
async def fetch_all_account_resources(conn): return await r.table('accounts')\ .filter((fetch_latest_block_num() >= r.row['start_block_num']) & (fetch_latest_block_num() < r.row['end_block_num']))\ .map(lambda account: account.merge( {'publicKey': account['public_key']}))\ .map(lambda account: account.merge( {'holdings': fetch_holdings(account['holdings'])}))\ .map(lambda account: (account['label'] == "").branch( account.without('label'), account))\ .map(lambda account: (account['description'] == "").branch( account.without('description'), account))\ .without('public_key', 'delta_id', 'start_block_num', 'end_block_num')\ .coerce_to('array').run(conn)
async def fetch_all_account_resources(conn): return await r.table('accounts')\ .filter((fetch_latest_block_num() >= r.row['start_block_num']) & (fetch_latest_block_num() < r.row['end_block_num']))\ .map(lambda account: account.merge( {'publicKey': account['public_key']}))\ .map(lambda account: account.merge( {'holdings': fetch_holdings(account['holdings'])}))\ .map(lambda account: (account['label'] == "").branch( account.without('label'), account))\ .map(lambda account: (account['description'] == "").branch( account.without('description'), account))\ .without('public_key', 'delta_id', 'start_block_num', 'end_block_num')\ .coerce_to('array').run(conn)
async def fetch_all_offer_resources(conn, query_params): return await r.table('offers')\ .filter((fetch_latest_block_num() >= r.row['start_block_num']) & (fetch_latest_block_num() < r.row['end_block_num']))\ .filter(query_params)\ .map(lambda offer: (offer['label'] == "").branch( offer.without('label'), offer))\ .map(lambda offer: (offer['description'] == "").branch( offer.without('description'), offer))\ .map(lambda offer: offer.merge( {'sourceQuantity': offer['source_quantity']}))\ .map(lambda offer: (offer['target'] == "").branch( offer.without('target'), offer))\ .map(lambda offer: (offer['target_quantity'] == "").branch( offer, offer.merge({'targetQuantity': offer['target_quantity']})))\ .map(lambda offer: (offer['rules'] == []).branch( offer, offer.merge(parse_rules(offer['rules']))))\ .without('delta_id', 'start_block_num', 'end_block_num', 'source_quantity', 'target_quantity')\ .coerce_to('array').run(conn)