yeref 0.24.86__py3-none-any.whl → 0.24.88__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
@@ -16558,7 +16558,70 @@ async def return_profit_and_loss_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P)
16558
16558
  sql = 'SELECT USER_TID, USER_VARS, USER_LSTS FROM "USER"'
16559
16559
  data_users = await db_select_pg(sql, (), BASE_P)
16560
16560
 
16561
- # Собираем MRR по месяцам
16561
+ months = ["2025-06", "2025-07", "2025-08", "2025-09"]
16562
+ data_users = []
16563
+ for _ in range(30):
16564
+ # дата входа
16565
+ entry_month = random.choice(months)
16566
+ entry_day = random.randint(1, 28)
16567
+ entry_date = f"{entry_month}-{entry_day:02}"
16568
+ entry_dt_obj = datetime.strptime(entry_date, '%Y-%m-%d')
16569
+ entry_dt = f"{entry_dt_obj.strftime('%d-%m-%Y')}_{datetime.now().strftime('%H-%M-%S')}"
16570
+ utm = random.choice(["/start", "/startapp"])
16571
+
16572
+ # месяцы от входа и дальше
16573
+ valid_months = [m for m in months if datetime.strptime(m + "-01", "%Y-%m-%d") >= entry_dt_obj.replace(day=1)]
16574
+ if not valid_months:
16575
+ valid_months = [entry_month]
16576
+
16577
+ user_mau = sorted(random.sample(valid_months, k=random.randint(1, len(valid_months))))
16578
+ user_dau_dates = set()
16579
+ txs, payments = [], []
16580
+
16581
+ # платеж
16582
+ if user_mau:
16583
+ pay_month = random.choice(user_mau)
16584
+ pay_day = random.randint(1, 28)
16585
+ pay_date = f"{pay_month}-{pay_day:02}"
16586
+ dt_pay = datetime.strptime(pay_date, "%Y-%m-%d")
16587
+ # if dt_pay >= entry_dt_obj:
16588
+ payments = [{
16589
+ "TYPE": random.choice(["don", "sub", "pst"]),
16590
+ "DT_START": f"{dt_pay.strftime('%d-%m-%Y')}_14-00-00",
16591
+ "DT_END": "0",
16592
+ "AMOUNT": str(random.randint(1, 10))
16593
+ }]
16594
+ user_dau_dates.add(pay_date)
16595
+
16596
+ # вход в приложение
16597
+ user_dau_dates.add(entry_date)
16598
+ for m in user_mau:
16599
+ day = random.randint(1, 28)
16600
+ visit = f"{m}-{day:02}"
16601
+ dt_visit = datetime.strptime(visit, "%Y-%m-%d")
16602
+ if dt_visit >= entry_dt_obj and random.random() < 0.7:
16603
+ user_dau_dates.add(visit)
16604
+
16605
+ # статусы (отток) с низкой вероятностью
16606
+ USER_STATUSES = []
16607
+ if random.random() < 0.2: # 10% шанс оттока
16608
+ churn_month = random.choice(valid_months)
16609
+ churn_day = random.randint(1, 28)
16610
+ churn_date = f"{churn_month}-{churn_day:02}"
16611
+ churn_ts = datetime.strptime(churn_date, "%Y-%m-%d").strftime("%d-%m-%Y") + "_23-59-59"
16612
+ USER_STATUSES = [{random.choice(["left", "kicked"]): churn_ts}]
16613
+
16614
+ user_dau = sorted(user_dau_dates)
16615
+ wallet = f"wallet{random.randint(1, 100)}" if txs else random.choice([f"wallet{random.randint(1, 100)}", ""])
16616
+
16617
+ data_users.append((
16618
+ random.randint(100000, 999999),
16619
+ json.dumps({"USER_WALLET": wallet, "USER_UTM": utm, "USER_DT": entry_dt}),
16620
+ json.dumps({"USER_DAU": user_dau, "USER_MAU": user_mau, "USER_TXS": txs,
16621
+ "USER_PAYMENTS": payments, "USER_STATUSES": USER_STATUSES})
16622
+ ))
16623
+ print(f"gen {data_users=}")
16624
+
16562
16625
  metrics = defaultdict(lambda: {"sum_amount": 0.0})
16563
16626
 
16564
16627
  for USER_TID, USER_VARS, USER_LSTS in data_users:
@@ -16593,7 +16656,7 @@ async def return_profit_and_loss_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P)
16593
16656
  NP = OP - COMM - EXCH
16594
16657
 
16595
16658
  results.append([
16596
- mon_str,
16659
+ mo,
16597
16660
  fmt(MRR),
16598
16661
  fmt(COGS),
16599
16662
  fmt(GP),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.24.86
3
+ Version: 0.24.88
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=d6cQ4nZTdm4j2P_EVMw3ztAbtme43uZpmh7v6Exeep4,1059616
5
+ yeref-0.24.88.dist-info/METADATA,sha256=bMe_vwX04ThcD8_3gV7is-LdBOKSXuI-9mmODL9R8IU,119
6
+ yeref-0.24.88.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ yeref-0.24.88.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
+ yeref-0.24.88.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=YVGElp4tMjIk6QATN_Q7LIkmlpzDBBDs7LZTL1R9dS4,1056580
5
- yeref-0.24.86.dist-info/METADATA,sha256=MdGR5-6GKeAwfUB8MlxyMoZz_MaDw8GIoi62l6Ed6so,119
6
- yeref-0.24.86.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- yeref-0.24.86.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
- yeref-0.24.86.dist-info/RECORD,,