Hi
Here is your today report
- All Terminals belonging to the merchants are inactive for 10 <= x >= 2 days <List: machant, terminal_id, tid, name, last_transaction date... /> Danh sách các terminal không có transaction trong 2 ngày tính từ ngày có transaction cuối cùng.
30 <= current_date >= last_transaction_date + 2 => true else false
- More than 80% of terminals belonging to the same merchant are inactive for 5 days Những cái inactive trong vòng 5 ngày của 1 marchaint có 80% terminals inactive trong 5 ngày.
def is_inactive_in_days(tid, last_transaction_date, days=5):
is_inactive = current_date == last_transaction_date + days
inactive_marchant = []
for marchant in marchaints:
count(inactive_terminals_belong_to_marchant) >= 80%
return inactive_marchant.insert(marchant)
<List: machant, terminal_id, tid, name, last_transaction date... />
- Other terminals are inactive for more than 10 days. Danh sách tất cả terminals không hoạt động trong 10 ngày gần nhất.
current_date > last_transaction_date + 10 => true else false