yeref 0.24.86__tar.gz → 0.24.88__tar.gz
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-0.24.86 → yeref-0.24.88}/PKG-INFO +1 -1
- {yeref-0.24.86 → yeref-0.24.88}/setup.py +1 -1
- {yeref-0.24.86 → yeref-0.24.88}/yeref/yeref.py +65 -2
- {yeref-0.24.86 → yeref-0.24.88}/yeref.egg-info/PKG-INFO +1 -1
- {yeref-0.24.86 → yeref-0.24.88}/pyproject.toml +0 -0
- {yeref-0.24.86 → yeref-0.24.88}/setup.cfg +0 -0
- {yeref-0.24.86 → yeref-0.24.88}/yeref/__init__.py +0 -0
- {yeref-0.24.86 → yeref-0.24.88}/yeref/l_.py +0 -0
- {yeref-0.24.86 → yeref-0.24.88}/yeref/tonweb.js +0 -0
- {yeref-0.24.86 → yeref-0.24.88}/yeref.egg-info/SOURCES.txt +0 -0
- {yeref-0.24.86 → yeref-0.24.88}/yeref.egg-info/dependency_links.txt +0 -0
- {yeref-0.24.86 → yeref-0.24.88}/yeref.egg-info/top_level.txt +0 -0
@@ -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
|
-
|
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
|
-
|
16659
|
+
mo,
|
16597
16660
|
fmt(MRR),
|
16598
16661
|
fmt(COGS),
|
16599
16662
|
fmt(GP),
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|