yeref 0.24.83__tar.gz → 0.24.85__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.83 → yeref-0.24.85}/PKG-INFO +1 -1
- {yeref-0.24.83 → yeref-0.24.85}/setup.py +1 -1
- {yeref-0.24.83 → yeref-0.24.85}/yeref/yeref.py +10 -68
- {yeref-0.24.83 → yeref-0.24.85}/yeref.egg-info/PKG-INFO +1 -1
- {yeref-0.24.83 → yeref-0.24.85}/pyproject.toml +0 -0
- {yeref-0.24.83 → yeref-0.24.85}/setup.cfg +0 -0
- {yeref-0.24.83 → yeref-0.24.85}/yeref/__init__.py +0 -0
- {yeref-0.24.83 → yeref-0.24.85}/yeref/l_.py +0 -0
- {yeref-0.24.83 → yeref-0.24.85}/yeref/tonweb.js +0 -0
- {yeref-0.24.83 → yeref-0.24.85}/yeref.egg-info/SOURCES.txt +0 -0
- {yeref-0.24.83 → yeref-0.24.85}/yeref.egg-info/dependency_links.txt +0 -0
- {yeref-0.24.83 → yeref-0.24.85}/yeref.egg-info/top_level.txt +0 -0
@@ -16555,76 +16555,13 @@ async def return_retention_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
16555
16555
|
|
16556
16556
|
async def return_profit_and_loss_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
16557
16557
|
try:
|
16558
|
-
sql = 'SELECT USER_LSTS FROM "USER"'
|
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
|
-
|
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
|
-
|
16561
|
+
# Собираем MRR по месяцам
|
16625
16562
|
metrics = defaultdict(lambda: {"sum_amount": 0.0})
|
16626
16563
|
|
16627
|
-
for
|
16564
|
+
for USER_TID, USER_VARS, USER_LSTS in data_users:
|
16628
16565
|
USER_LSTS = json.loads(USER_LSTS or "{}")
|
16629
16566
|
USER_PAYMENTS = USER_LSTS.get("USER_PAYMENTS", [])
|
16630
16567
|
|
@@ -16635,12 +16572,17 @@ async def return_profit_and_loss_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P)
|
|
16635
16572
|
metrics[mo_p]["sum_amount"] += amt
|
16636
16573
|
|
16637
16574
|
def fmt(x):
|
16638
|
-
return f"{x:.2f}".rstrip("0").rstrip(".")
|
16575
|
+
return f"{x:.2f}".rstrip("0").rstrip(".") if x is not None else ""
|
16639
16576
|
|
16577
|
+
# Сортируем месяцы
|
16640
16578
|
months_sorted = sorted(metrics.keys())
|
16641
16579
|
results = []
|
16642
16580
|
|
16643
16581
|
for mo in months_sorted:
|
16582
|
+
# Преобразуем "2025-06" → "JUN"
|
16583
|
+
dt_mo = datetime.strptime(mo, "%Y-%m")
|
16584
|
+
mon_str = dt_mo.strftime("%b").upper()
|
16585
|
+
|
16644
16586
|
MRR = metrics[mo]["sum_amount"]
|
16645
16587
|
COGS = 0.0
|
16646
16588
|
GP = MRR - COGS
|
@@ -16651,7 +16593,7 @@ async def return_profit_and_loss_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P)
|
|
16651
16593
|
NP = OP - COMM - EXCH
|
16652
16594
|
|
16653
16595
|
results.append([
|
16654
|
-
|
16596
|
+
mon_str,
|
16655
16597
|
fmt(MRR),
|
16656
16598
|
fmt(COGS),
|
16657
16599
|
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
|