Skip to content

Instantly share code, notes, and snippets.

@hprobotic
Last active July 27, 2020 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hprobotic/87081ed47b701b6b1ad0b1ddae67c021 to your computer and use it in GitHub Desktop.
Save hprobotic/87081ed47b701b6b1ad0b1ddae67c021 to your computer and use it in GitHub Desktop.

Hi

Here is your today report

  1. 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
  1. 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... />

  1. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment