]>
apps.delaporte.us Git - matrix-shop-bot.git/blob - matrix_shop_bot/tasks.py
f4775fa22d1eec00f7518a585258cbe87f3c08ca
1 from invoke
import task
6 logging
.getLogger('invoke').setLevel(logging
.WARNING
)
7 logging
.basicConfig(filename
=f
'matrix-shop-bot.log', encoding
='utf-8', level
=logging
.DEBUG
)
11 result
= Data().setup()
15 def add_item(c
, name
):
16 result
= Data().add_item(name
)
20 def add_store(c
, name
):
21 result
= Data().add_store(name
)
26 def assign(c
, item_id
):
27 result
= Data().assign_last_store(item_id
)
32 def assign_to_store(c
, item_id
, store_id
):
33 result
= Data().assign_store(store_id
, item_id
)
39 result
= Data().purchase_items(items
)
43 def list_bought(c
, store
):
44 result
= Data().list_purchases(store
)
49 def clear_all(c
, store_id
):
50 Data().clear_list(store_id
, clear_all
=True)
53 def clear_list(c
, store_id
):
54 Data().clear_list(store_id
)
58 def list_for_store(c
, store_id
):
59 items
= Data().get_shopping_list_for_store(store_id
)
66 '''Use previous store'''
67 items
= Data().get_last_shopping_list()
73 items
= Data().get_stores()
80 items
= Data().get_unsorted_list()
86 def remove_item(c
, item_id
):
87 Data().remove_item(item_id
)
90 def remove_store(c
, store_id
):
91 Data().remove_store(store_id
)