yeref 0.24.41__tar.gz → 0.24.43__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.41 → yeref-0.24.43}/PKG-INFO +1 -1
- {yeref-0.24.41 → yeref-0.24.43}/setup.py +1 -1
- {yeref-0.24.41 → yeref-0.24.43}/yeref/yeref.py +84 -6
- {yeref-0.24.41 → yeref-0.24.43}/yeref.egg-info/PKG-INFO +1 -1
- {yeref-0.24.41 → yeref-0.24.43}/pyproject.toml +0 -0
- {yeref-0.24.41 → yeref-0.24.43}/setup.cfg +0 -0
- {yeref-0.24.41 → yeref-0.24.43}/yeref/__init__.py +0 -0
- {yeref-0.24.41 → yeref-0.24.43}/yeref/l_.py +0 -0
- {yeref-0.24.41 → yeref-0.24.43}/yeref/tonweb.js +0 -0
- {yeref-0.24.41 → yeref-0.24.43}/yeref.egg-info/SOURCES.txt +0 -0
- {yeref-0.24.41 → yeref-0.24.43}/yeref.egg-info/dependency_links.txt +0 -0
- {yeref-0.24.41 → yeref-0.24.43}/yeref.egg-info/top_level.txt +0 -0
@@ -15954,7 +15954,77 @@ async def return_view_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
15954
15954
|
wallets_set = set()
|
15955
15955
|
users_set = set()
|
15956
15956
|
|
15957
|
-
def process_user_rows(rows):
|
15957
|
+
def process_user_rows(rows, schema_name=""):
|
15958
|
+
# months = ["2025-06", "2025-07", "2025-08", "2025-09"]
|
15959
|
+
# data_users = []
|
15960
|
+
# for _ in range(3):
|
15961
|
+
# # дата входа
|
15962
|
+
# entry_month = random.choice(months)
|
15963
|
+
# entry_day = random.randint(1, 28)
|
15964
|
+
# entry_date = f"{entry_month}-{entry_day:02}"
|
15965
|
+
# entry_dt_obj = datetime.strptime(entry_date, '%Y-%m-%d')
|
15966
|
+
# entry_dt = f"{entry_dt_obj.strftime('%d-%m-%Y')}_{datetime.now().strftime('%H-%M-%S')}"
|
15967
|
+
# utm = random.choice(["/start", "/startapp"])
|
15968
|
+
#
|
15969
|
+
# # месяцы от входа и дальше
|
15970
|
+
# valid_months = [m for m in months if datetime.strptime(m + "-01", "%Y-%m-%d") >= entry_dt_obj.replace(day=1)]
|
15971
|
+
# if not valid_months:
|
15972
|
+
# valid_months = [entry_month]
|
15973
|
+
#
|
15974
|
+
# user_mau = sorted(random.sample(valid_months, k=random.randint(1, len(valid_months))))
|
15975
|
+
# user_dau_dates = set()
|
15976
|
+
# txs, payments = [], []
|
15977
|
+
#
|
15978
|
+
# # транзакция
|
15979
|
+
# if user_mau and random.random() < 0.5:
|
15980
|
+
# tx_month = random.choice(user_mau)
|
15981
|
+
# tx_day = random.randint(1, 28)
|
15982
|
+
# tx_date = f"{tx_month}-{tx_day:02}"
|
15983
|
+
# dt_tx = datetime.strptime(tx_date, "%Y-%m-%d")
|
15984
|
+
# if dt_tx >= entry_dt_obj:
|
15985
|
+
# txs = [{
|
15986
|
+
# "TYPE": random.choice(["don", "sub", "pst"]),
|
15987
|
+
# "AMOUNT": str(random.randint(1, 10)),
|
15988
|
+
# "ADDRESS": f"address{random.randint(1, 999)}",
|
15989
|
+
# "DT_START": f"{dt_tx.strftime('%d-%m-%Y')}_12-00-00",
|
15990
|
+
# }]
|
15991
|
+
# user_dau_dates.add(tx_date)
|
15992
|
+
#
|
15993
|
+
# # платеж
|
15994
|
+
# if user_mau and random.random() < 0.5:
|
15995
|
+
# pay_month = random.choice(user_mau)
|
15996
|
+
# pay_day = random.randint(1, 28)
|
15997
|
+
# pay_date = f"{pay_month}-{pay_day:02}"
|
15998
|
+
# dt_pay = datetime.strptime(pay_date, "%Y-%m-%d")
|
15999
|
+
# if dt_pay >= entry_dt_obj:
|
16000
|
+
# payments = [{
|
16001
|
+
# "TYPE": random.choice(["don", "sub", "pst"]),
|
16002
|
+
# "DT_START": f"{dt_pay.strftime('%d-%m-%Y')}_14-00-00",
|
16003
|
+
# "DT_END": "0",
|
16004
|
+
# "AMOUNT": str(random.randint(1, 10))
|
16005
|
+
# }]
|
16006
|
+
# user_dau_dates.add(pay_date)
|
16007
|
+
#
|
16008
|
+
# # вход в приложение
|
16009
|
+
# user_dau_dates.add(entry_date)
|
16010
|
+
#
|
16011
|
+
# # остальные посещения
|
16012
|
+
# for m in user_mau:
|
16013
|
+
# day = random.randint(1, 28)
|
16014
|
+
# visit = f"{m}-{day:02}"
|
16015
|
+
# dt_visit = datetime.strptime(visit, "%Y-%m-%d")
|
16016
|
+
# if dt_visit >= entry_dt_obj and random.random() < 0.7:
|
16017
|
+
# user_dau_dates.add(visit)
|
16018
|
+
#
|
16019
|
+
# user_dau = sorted(user_dau_dates)
|
16020
|
+
# wallet = f"wallet{random.randint(1, 100)}" if txs else random.choice([f"wallet{random.randint(1, 100)}", ""])
|
16021
|
+
#
|
16022
|
+
# data_users.append((
|
16023
|
+
# random.randint(100000, 999999),
|
16024
|
+
# json.dumps({"USER_WALLET": wallet, "USER_UTM": utm, "USER_DT": entry_dt}),
|
16025
|
+
# json.dumps({"USER_DAU": user_dau, "USER_MAU": user_mau, "USER_TXS": txs, "USER_PAYMENTS": payments})
|
16026
|
+
# ))
|
16027
|
+
|
15958
16028
|
for USER_TID, USER_VARS, USER_LSTS in rows:
|
15959
16029
|
USER_VARS = json.loads(USER_VARS or "{}")
|
15960
16030
|
USER_LSTS = json.loads(USER_LSTS or "{}")
|
@@ -15968,7 +16038,13 @@ async def return_view_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
15968
16038
|
USER_STATUSES = USER_LSTS.get("USER_STATUSES", [])
|
15969
16039
|
|
15970
16040
|
if USER_WALLET: wallets_set.add(USER_WALLET)
|
15971
|
-
if
|
16041
|
+
if USER_STATUSES:
|
16042
|
+
last_status = max(USER_STATUSES, key=lambda x: list(x.values())[0])
|
16043
|
+
last_key = list(last_status.keys())[0]
|
16044
|
+
if last_key not in ['left', 'kicked']:
|
16045
|
+
users_set.add(USER_TID)
|
16046
|
+
else:
|
16047
|
+
users_set.add(USER_TID)
|
15972
16048
|
|
15973
16049
|
for day_str in USER_DAU:
|
15974
16050
|
dt_day = datetime.strptime(day_str, "%Y-%m-%d")
|
@@ -16007,27 +16083,29 @@ async def return_view_metrics(bot, PROJECT_USERNAME, EXTRA_D, BASE_P):
|
|
16007
16083
|
ENT_TID = item[0]
|
16008
16084
|
sql = f'SELECT USER_TID, USER_VARS, USER_LSTS FROM {schema_name}_{ENT_TID}.USER'
|
16009
16085
|
data_users = await db_select_pg(sql, (), BASE_P)
|
16010
|
-
|
16086
|
+
print(f"schema_name {data_users=}")
|
16087
|
+
process_user_rows(data_users, schema_name)
|
16011
16088
|
|
16012
16089
|
sql = f"SELECT USER_TID, USER_VARS, USER_LSTS FROM \"USER\""
|
16013
16090
|
data_users = await db_select_pg(sql, (), BASE_P)
|
16091
|
+
print(f"{data_users=}")
|
16014
16092
|
process_user_rows(data_users)
|
16015
16093
|
|
16016
16094
|
all_months = sorted(metrics_by_month.keys())
|
16017
16095
|
f_name = os.path.join(EXTRA_D, "1_metrics.csv")
|
16018
16096
|
with open(f_name, mode="w", encoding="utf-8", newline="") as csvfile:
|
16019
16097
|
writer = csv.writer(csvfile, delimiter=',')
|
16020
|
-
writer.writerow(["MO", "DAU", "MAU", "Wallets", "TX Count", "PAY Count", "
|
16098
|
+
writer.writerow(["MO", "/start", "/startapp", "DAU", "MAU", "Wallets", "TX Count", "PAY Count", "TVL"])
|
16021
16099
|
for ym in all_months:
|
16022
16100
|
row = [
|
16023
16101
|
ym,
|
16102
|
+
metrics_by_month[ym]["/start"],
|
16103
|
+
metrics_by_month[ym]["/startapp"],
|
16024
16104
|
metrics_by_month[ym]["dau"],
|
16025
16105
|
metrics_by_month[ym]["mau"],
|
16026
16106
|
metrics_by_month[ym]["wallets"],
|
16027
16107
|
metrics_by_month[ym]["tx"],
|
16028
16108
|
metrics_by_month[ym]["pay"],
|
16029
|
-
metrics_by_month[ym]["/start"],
|
16030
|
-
metrics_by_month[ym]["/startapp"],
|
16031
16109
|
"",
|
16032
16110
|
]
|
16033
16111
|
writer.writerow(row)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|