X-Git-Url: https://apps.delaporte.us/gitweb/matrix-shop-bot.git/blobdiff_plain/b87cc9cac0fee1d8d1c281a3f445097cb8af2691..99af120949f95dc808a99e4e32049da0dc8c064f:/matrix_shop_bot/tasks.py diff --git a/matrix_shop_bot/tasks.py b/matrix_shop_bot/tasks.py index 54cafd1..29911a9 100644 --- a/matrix_shop_bot/tasks.py +++ b/matrix_shop_bot/tasks.py @@ -19,14 +19,20 @@ def add_store(c, name): @task -def assign(c, store_id, item_id): +def assign(c, item_id): + result = Data().assign_last_store(item_id) + print(result) + + +@task +def assign_to_store(c, item_id, store_id): result = Data().assign_store(store_id, item_id) print(result) @task -def buy(c, item_id): - result = Data().purchase_item(item_id) +def buy(c, items): + result = Data().purchase_items(items) print(result) @task @@ -39,10 +45,16 @@ def clear_list(c, store_id): @task -def list(c, store_id_str=None): +def list_for_store(c, store_id): + items = Data().get_shopping_list_for_store(store_id) + for item in items: + print(item) - store_id = int(store_id_str) if store_id_str else None - items = Data().get_shopping_list(store_id) + +@task +def list(c): + '''Use previous store''' + items = Data().get_last_shopping_list() for item in items: print(item)