re-enable bounce report in daily report

This commit is contained in:
Son 2021-11-04 14:28:19 +01:00
parent f8b6b20dd8
commit 914696ef3b
1 changed files with 21 additions and 24 deletions

45
cron.py
View File

@ -382,14 +382,14 @@ def all_bounce_report() -> str:
) )
for email, count in query: for email, count in query:
res += "----\n"
res += f"{email}: {count} bounces. " res += f"{email}: {count} bounces. "
most_recent: Bounce = ( most_recent: Bounce = (
Bounce.filter(Bounce.email == email) Bounce.filter(Bounce.email == email)
.order_by(Bounce.created_at.desc()) .order_by(Bounce.created_at.desc())
.first() .first()
) )
res += f"Most recent cause: {most_recent.info}\n" res += f"Most recent cause: \n{most_recent.info or ''}"
res += "\n----\n"
return res return res
@ -487,28 +487,25 @@ nb_referred_user: {stats_today.nb_referred_user} - {increase_percent(stats_yeste
nb_referred_user_upgrade: {stats_today.nb_referred_user_paid} - {increase_percent(stats_yesterday.nb_referred_user_paid, stats_today.nb_referred_user_paid)} nb_referred_user_upgrade: {stats_today.nb_referred_user_paid} - {increase_percent(stats_yesterday.nb_referred_user_paid, stats_today.nb_referred_user_paid)}
""" """
# todo: re-enable report += "\n====================================\n"
# report += f""" report += f"""
# ---- # Account bounce report:
# Bounce report: """
# """
# for email, bounces in bounce_report():
# for email, bounces in bounce_report(): report += f"{email}: {bounces} "
# report += f"{email}: {bounces} "
# report += f"""\n
# report += f""" # Alias creation report:
# ----- """
# Alias creation report:
# """ for email, nb_alias, date in alias_creation_report():
# report += f"{email}, {date}: {nb_alias}\n"
# for email, nb_alias, date in alias_creation_report():
# report += f"{email}, {date}: {nb_alias}\n" report += f"""\n
# # Full bounce detail report:
# report += f""" """
# ----- report += all_bounce_report()
# Bounce detail report:
# """
# report += all_bounce_report()
LOG.d("report email: %s", report) LOG.d("report email: %s", report)