yeref 0.24.72__py3-none-any.whl → 0.24.73__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
@@ -16496,35 +16496,39 @@ async def return_retention_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
16496
16496
  if not cohort_months:
16497
16497
  return
16498
16498
 
16499
- max_offset = 0
16500
- for c in cohort_months:
16501
- if rev_by_cohort[c]:
16502
- max_offset = max(max_offset, max(rev_by_cohort[c].keys()))
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}"
16503
16506
 
16504
- base_rev = {c: rev_by_cohort[c].get(0, 0.0) for c in cohort_months}
16507
+ num_cohorts = len(cohort_months)
16508
+ first_cohort = cohort_months[0]
16505
16509
 
16506
16510
  path = os.path.join(EXTRA_D, "4_retention_metrics.csv")
16507
16511
  with open(path, "w", newline="", encoding="utf-8") as f:
16508
16512
  writer = csv.writer(f)
16509
- header = ["Месяц / Когорта"] + [
16513
+ header = ["Месяц/Когорта"] + [
16510
16514
  f"{c} ({len(cohort_users[c])})" for c in cohort_months
16511
16515
  ] + ["∑"]
16512
16516
  writer.writerow(header)
16513
16517
 
16514
- for i in range(max_offset + 1):
16515
- row = [f"M{i+1} ({i} мес)"]
16518
+ for i in range(num_cohorts):
16519
+ calendar_mo = add_months(first_cohort, i)
16520
+ row = [f"M{i+1}"]
16516
16521
  row_sum = 0.0
16517
16522
  for c in cohort_months:
16518
- rev = rev_by_cohort[c].get(i, 0.0)
16519
- if i == 0:
16520
- pct = 100
16521
- cell = f"{rev:.1f} ({pct}%)"
16522
- row.append(cell)
16523
- row_sum += rev
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
+ row.append("")
16524
16528
  else:
16525
- if base_rev[c] > 0 and rev > 0:
16526
- pct = rev / base_rev[c] * 100
16527
- cell = f"{rev:.1f} ({pct:.0f}%)"
16529
+ rev = rev_by_cohort[c].get(offset, 0.0)
16530
+ if rev > 0:
16531
+ cell = f"{rev:.1f}"
16528
16532
  row.append(cell)
16529
16533
  row_sum += rev
16530
16534
  else:
@@ -16539,6 +16543,7 @@ async def return_retention_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
16539
16543
  logger.info(log_ % str(e))
16540
16544
  await asyncio.sleep(round(random.uniform(0, 1), 2))
16541
16545
 
16546
+
16542
16547
  # endregion
16543
16548
 
16544
16549
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.24.72
3
+ Version: 0.24.73
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=MwzWQTSqgeehsMOK_9lsWv6BwiTcmt3vIaOggbD04lk,1053721
5
+ yeref-0.24.73.dist-info/METADATA,sha256=VukAmV-sflraUOmoDqfbN94BUREeH_TMfdieUYeyq3I,119
6
+ yeref-0.24.73.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ yeref-0.24.73.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
+ yeref-0.24.73.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=1-L6dVAq_xTXov1GgtVeKxR_lILTWNYchR_4eLMllas,1053574
5
- yeref-0.24.72.dist-info/METADATA,sha256=h8A8vUMv2uox_d_3WDGKpRXDutbbHe1G4WO1k_3ivXY,119
6
- yeref-0.24.72.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- yeref-0.24.72.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
8
- yeref-0.24.72.dist-info/RECORD,,