Commit 213876cf authored by Jérome Perrin's avatar Jérome Perrin

use Alice, Bob and candies in the example

parent bd7568ab
...@@ -215,21 +215,21 @@ This method does not check that the provided parameters leads to results that ma ...@@ -215,21 +215,21 @@ This method does not check that the provided parameters leads to results that ma
Using one `getInventoryList` is usually much more efficient than doing multiple `getInventory`/`getInventoryAssetPrice` calls. Using one `getInventoryList` is usually much more efficient than doing multiple `getInventory`/`getInventoryAssetPrice` calls.
For example, this code: For example, this code:
```python ```python
print "N1's inventory of R1 is {inventory}, value is {value}".format( print "Alice's has {inventory} candies, value is {value}".format(
inventory=getInventory(node_uid=N1.getUid(), resource=R1.getUid(), inventory=getInventory(node_uid=alice.getUid(), resource=candy.getUid(),
asset_price=getInventoryAssetPrice(node_uid=N1.getUid(), resource=R1.getUid())) asset_price=getInventoryAssetPrice(node_uid=alice.getUid(), resource_uid=candy.getUid()))
print "N2's inventory of R1 is {inventory}, value is {value}".format( print "Bob's has {inventory} candies, value is {value}".format(
inventory=getInventory(node_uid=N2.getUid(), resource=R1.getUid(), inventory=getInventory(node_uid=bob.getUid(), resource=candy.getUid(),
asset_price=getInventoryAssetPrice(node_uid=N2.getUid(), resource=R1.getUid())) asset_price=getInventoryAssetPrice(node_uid=bob.getUid(), resource_uid=candy.getUid()))
``` ```
can be written more efficiently with `getInventoryList` this way: can be written more efficiently with `getInventoryList` this way:
```python ```python
for brain in getInventoryList(node_uid=(N1.getUid(), N2.getUid()), for brain in getInventoryList(node_uid=(alice.getUid(), bob.getUid()),
resource_uid=R1.getUid(), resource_uid=candy.getUid(),
group_by_node=True): group_by_node=True):
print "{node}'s inventory of R1 is {inventory}, value is {value}".format( print "{node}'s inventory of candy is {inventory}, value is {value}".format(
node=brain.node_title, node=brain.node_title,
inventory=brain.total_inventory, inventory=brain.total_inventory,
asset_price=brain.total_price) asset_price=brain.total_price)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment