yeref 0.24.75__tar.gz → 0.24.76__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.75 → yeref-0.24.76}/PKG-INFO +1 -1
- {yeref-0.24.75 → yeref-0.24.76}/setup.py +1 -1
- {yeref-0.24.75 → yeref-0.24.76}/yeref/yeref.py +26 -17
- {yeref-0.24.75 → yeref-0.24.76}/yeref.egg-info/PKG-INFO +1 -1
- {yeref-0.24.75 → yeref-0.24.76}/pyproject.toml +0 -0
- {yeref-0.24.75 → yeref-0.24.76}/setup.cfg +0 -0
- {yeref-0.24.75 → yeref-0.24.76}/yeref/__init__.py +0 -0
- {yeref-0.24.75 → yeref-0.24.76}/yeref/l_.py +0 -0
- {yeref-0.24.75 → yeref-0.24.76}/yeref/tonweb.js +0 -0
- {yeref-0.24.75 → yeref-0.24.76}/yeref.egg-info/SOURCES.txt +0 -0
- {yeref-0.24.75 → yeref-0.24.76}/yeref.egg-info/dependency_links.txt +0 -0
- {yeref-0.24.75 → yeref-0.24.76}/yeref.egg-info/top_level.txt +0 -0
@@ -16496,35 +16496,43 @@ async def return_retention_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
16496
16496
|
if not cohort_months:
|
16497
16497
|
return
|
16498
16498
|
|
16499
|
-
#
|
16500
|
-
|
16501
|
-
|
16502
|
-
|
16503
|
-
|
16499
|
+
# Функция прибавления месяцев
|
16500
|
+
def add_months(mo_str, n):
|
16501
|
+
y, m = map(int, mo_str.split("-"))
|
16502
|
+
total = m + n
|
16503
|
+
new_y = y + (total - 1) // 12
|
16504
|
+
new_m = (total - 1) % 12 + 1
|
16505
|
+
return f"{new_y:04d}-{new_m:02d}"
|
16506
|
+
|
16507
|
+
num_cohorts = len(cohort_months)
|
16508
|
+
first_cohort = cohort_months[0]
|
16504
16509
|
|
16505
16510
|
path = os.path.join(EXTRA_D, "4_retention_metrics.csv")
|
16506
16511
|
with open(path, "w", newline="", encoding="utf-8") as f:
|
16507
16512
|
writer = csv.writer(f)
|
16508
|
-
|
16509
|
-
# заголовок
|
16510
16513
|
header = ["Месяц/Когорта"] + [
|
16511
|
-
f"{c} ({len(cohort_users[c])})"
|
16512
|
-
for c in cohort_months
|
16514
|
+
f"{c} ({len(cohort_users[c])})" for c in cohort_months
|
16513
16515
|
] + ["∑"]
|
16514
16516
|
writer.writerow(header)
|
16515
16517
|
|
16516
|
-
|
16517
|
-
|
16518
|
+
for i in range(num_cohorts):
|
16519
|
+
calendar_mo = add_months(first_cohort, i)
|
16518
16520
|
row = [f"M{i+1}"]
|
16519
16521
|
row_sum = 0.0
|
16520
16522
|
for c in cohort_months:
|
16521
|
-
|
16522
|
-
|
16523
|
-
|
16524
|
-
|
16525
|
-
row_sum += rev
|
16526
|
-
else:
|
16523
|
+
y0, m0 = map(int, c.split("-"))
|
16524
|
+
y1, m1 = map(int, calendar_mo.split("-"))
|
16525
|
+
offset = (y1 - y0) * 12 + (m1 - m0)
|
16526
|
+
if offset < 0:
|
16527
16527
|
row.append("")
|
16528
|
+
else:
|
16529
|
+
rev = rev_by_cohort[c].get(offset, 0.0)
|
16530
|
+
if rev > 0:
|
16531
|
+
cell = f"{rev:.1f}"
|
16532
|
+
row.append(cell)
|
16533
|
+
row_sum += rev
|
16534
|
+
else:
|
16535
|
+
row.append("")
|
16528
16536
|
row.append(f"{row_sum:.1f}")
|
16529
16537
|
writer.writerow(row)
|
16530
16538
|
|
@@ -16535,6 +16543,7 @@ async def return_retention_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
16535
16543
|
logger.info(log_ % str(e))
|
16536
16544
|
await asyncio.sleep(round(random.uniform(0, 1), 2))
|
16537
16545
|
|
16546
|
+
|
16538
16547
|
# endregion
|
16539
16548
|
|
16540
16549
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|