yeref 0.24.41__py3-none-any.whl → 0.24.42__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
yeref/yeref.py CHANGED
@@ -15955,6 +15955,76 @@ async def return_view_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
15955
15955
  users_set = set()
15956
15956
 
15957
15957
  def process_user_rows(rows):
15958
+ # months = ["2025-06", "2025-07", "2025-08", "2025-09"]
15959
+ # data_users = []
15960
+ # for _ in range(3):
15961
+ # # дата входа
15962
+ # entry_month = random.choice(months)
15963
+ # entry_day = random.randint(1, 28)
15964
+ # entry_date = f"{entry_month}-{entry_day:02}"
15965
+ # entry_dt_obj = datetime.strptime(entry_date, '%Y-%m-%d')
15966
+ # entry_dt = f"{entry_dt_obj.strftime('%d-%m-%Y')}_{datetime.now().strftime('%H-%M-%S')}"
15967
+ # utm = random.choice(["/start", "/startapp"])
15968
+ #
15969
+ # # месяцы от входа и дальше
15970
+ # valid_months = [m for m in months if datetime.strptime(m + "-01", "%Y-%m-%d") >= entry_dt_obj.replace(day=1)]
15971
+ # if not valid_months:
15972
+ # valid_months = [entry_month]
15973
+ #
15974
+ # user_mau = sorted(random.sample(valid_months, k=random.randint(1, len(valid_months))))
15975
+ # user_dau_dates = set()
15976
+ # txs, payments = [], []
15977
+ #
15978
+ # # транзакция
15979
+ # if user_mau and random.random() < 0.5:
15980
+ # tx_month = random.choice(user_mau)
15981
+ # tx_day = random.randint(1, 28)
15982
+ # tx_date = f"{tx_month}-{tx_day:02}"
15983
+ # dt_tx = datetime.strptime(tx_date, "%Y-%m-%d")
15984
+ # if dt_tx >= entry_dt_obj:
15985
+ # txs = [{
15986
+ # "TYPE": random.choice(["don", "sub", "pst"]),
15987
+ # "AMOUNT": str(random.randint(1, 10)),
15988
+ # "ADDRESS": f"address{random.randint(1, 999)}",
15989
+ # "DT_START": f"{dt_tx.strftime('%d-%m-%Y')}_12-00-00",
15990
+ # }]
15991
+ # user_dau_dates.add(tx_date)
15992
+ #
15993
+ # # платеж
15994
+ # if user_mau and random.random() < 0.5:
15995
+ # pay_month = random.choice(user_mau)
15996
+ # pay_day = random.randint(1, 28)
15997
+ # pay_date = f"{pay_month}-{pay_day:02}"
15998
+ # dt_pay = datetime.strptime(pay_date, "%Y-%m-%d")
15999
+ # if dt_pay >= entry_dt_obj:
16000
+ # payments = [{
16001
+ # "TYPE": random.choice(["don", "sub", "pst"]),
16002
+ # "DT_START": f"{dt_pay.strftime('%d-%m-%Y')}_14-00-00",
16003
+ # "DT_END": "0",
16004
+ # "AMOUNT": str(random.randint(1, 10))
16005
+ # }]
16006
+ # user_dau_dates.add(pay_date)
16007
+ #
16008
+ # # вход в приложение
16009
+ # user_dau_dates.add(entry_date)
16010
+ #
16011
+ # # остальные посещения
16012
+ # for m in user_mau:
16013
+ # day = random.randint(1, 28)
16014
+ # visit = f"{m}-{day:02}"
16015
+ # dt_visit = datetime.strptime(visit, "%Y-%m-%d")
16016
+ # if dt_visit >= entry_dt_obj and random.random() < 0.7:
16017
+ # user_dau_dates.add(visit)
16018
+ #
16019
+ # user_dau = sorted(user_dau_dates)
16020
+ # wallet = f"wallet{random.randint(1, 100)}" if txs else random.choice([f"wallet{random.randint(1, 100)}", ""])
16021
+ #
16022
+ # data_users.append((
16023
+ # random.randint(100000, 999999),
16024
+ # json.dumps({"USER_WALLET": wallet, "USER_UTM": utm, "USER_DT": entry_dt}),
16025
+ # json.dumps({"USER_DAU": user_dau, "USER_MAU": user_mau, "USER_TXS": txs, "USER_PAYMENTS": payments})
16026
+ # ))
16027
+
15958
16028
  for USER_TID, USER_VARS, USER_LSTS in rows:
15959
16029
  USER_VARS = json.loads(USER_VARS or "{}")
15960
16030
  USER_LSTS = json.loads(USER_LSTS or "{}")
@@ -15968,7 +16038,13 @@ async def return_view_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
15968
16038
  USER_STATUSES = USER_LSTS.get("USER_STATUSES", [])
15969
16039
 
15970
16040
  if USER_WALLET: wallets_set.add(USER_WALLET)
15971
- if not len(USER_STATUSES): users_set.add(USER_TID)
16041
+ if USER_STATUSES:
16042
+ last_status = max(USER_STATUSES, key=lambda x: list(x.values())[0])
16043
+ last_key = list(last_status.keys())[0]
16044
+ if last_key not in ['left', 'kicked']:
16045
+ users_set.add(USER_TID)
16046
+ else:
16047
+ users_set.add(USER_TID)
15972
16048
 
15973
16049
  for day_str in USER_DAU:
15974
16050
  dt_day = datetime.strptime(day_str, "%Y-%m-%d")
@@ -16007,10 +16083,12 @@ async def return_view_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
16007
16083
  ENT_TID = item[0]
16008
16084
  sql = f'SELECT USER_TID, USER_VARS, USER_LSTS FROM {schema_name}_{ENT_TID}.USER'
16009
16085
  data_users = await db_select_pg(sql, (), BASE_P)
16086
+ print(f"{data_users=}")
16010
16087
  process_user_rows(data_users)
16011
16088
 
16012
16089
  sql = f"SELECT USER_TID, USER_VARS, USER_LSTS FROM \"USER\""
16013
16090
  data_users = await db_select_pg(sql, (), BASE_P)
16091
+ print(f"{data_users=}")
16014
16092
  process_user_rows(data_users)
16015
16093
 
16016
16094
  all_months = sorted(metrics_by_month.keys())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.24.41
3
+ Version: 0.24.42
4
4
  Summary: desc-f
5
5
  Author: john smith
6
6
  Dynamic: author
@@ -0,0 +1,8 @@
1
+ yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
2
+ yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
3
+ yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
4
+ yeref/yeref.py,sha256=6D959cqtxt0UZHhaxUQPIItzS5112QPwUjvD0gFqqHo,1035911
5
+ yeref-0.24.42.dist-info/METADATA,sha256=woOVXmutBY_Iy1J77tNAEWCTo10T_w9i9qYFUvywnnI,119
6
+ yeref-0.24.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ yeref-0.24.42.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
+ yeref-0.24.42.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
2
- yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
3
- yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
4
- yeref/yeref.py,sha256=ypQzkPeLdq27uUvefPw5__VoeAbZkhZdznkEQE8JBq0,1031798
5
- yeref-0.24.41.dist-info/METADATA,sha256=Ubs6E_PyhU1NVfxZDtR8t37LSoEJdtdznQlfHFnywlw,119
6
- yeref-0.24.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- yeref-0.24.41.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
- yeref-0.24.41.dist-info/RECORD,,