diff --git a/app/config.py b/app/config.py index ae2082ee..3473ce8d 100644 --- a/app/config.py +++ b/app/config.py @@ -30,6 +30,8 @@ COLOR_LOG = "COLOR_LOG" in os.environ # Allow user to have 1 year of premium: set the expiration_date to 1 year more PROMO_CODE = "SIMPLEISBETTER" +# Debug mode +DEBUG = os.environ["DEBUG"] if "DEBUG" in os.environ else False # Server url URL = os.environ["URL"] print(">>> URL:", URL) diff --git a/app/dashboard/templates/dashboard/alias_log.html b/app/dashboard/templates/dashboard/alias_log.html index 59c40d06..130a37b5 100644 --- a/app/dashboard/templates/dashboard/alias_log.html +++ b/app/dashboard/templates/dashboard/alias_log.html @@ -1,7 +1,68 @@ {% extends 'default.html' %} {% set active_page = "dashboard" %} +{% block head %} + +{% endblock %} {% block title %} Alias Activity {% endblock %} @@ -12,7 +73,37 @@ {{ alias }} - +
+
+
+ + {{ total }} + Email Handled +
+
+
+
+ + {{ email_forwarded }} + Email Forwarded +
+
+
+
+ + {{ email_replied }} + Email Replied +
+
+
+
+ + {{ email_blocked }} + Email Blocked +
+
+
+

Activities

{% for log in logs %}
diff --git a/app/dashboard/views/alias_log.py b/app/dashboard/views/alias_log.py index d7ec6388..6878b130 100644 --- a/app/dashboard/views/alias_log.py +++ b/app/dashboard/views/alias_log.py @@ -38,6 +38,19 @@ def alias_log(alias, page_id): return redirect(url_for("dashboard.index")) logs = get_alias_log(gen_email, page_id) + base = ( + db.session.query(ForwardEmail, ForwardEmailLog) + .filter(ForwardEmail.id == ForwardEmailLog.forward_id) + .filter(ForwardEmail.gen_email_id == gen_email.id) + ) + total = base.count() + email_forwarded = ( + base.filter(ForwardEmailLog.is_reply == False) + .filter(ForwardEmailLog.blocked == False) + .count() + ) + email_replied = base.filter(ForwardEmailLog.is_reply == True).count() + email_blocked = base.filter(ForwardEmailLog.blocked == True).count() last_page = ( len(logs) < _LIMIT ) # lightweight pagination without counting all objects diff --git a/server.py b/server.py index 08d95c42..e51272c2 100644 --- a/server.py +++ b/server.py @@ -18,6 +18,7 @@ from app.admin_model import SLModelView, SLAdminIndexView from app.api.base import api_bp from app.auth.base import auth_bp from app.config import ( + DEBUG, DB_URI, FLASK_SECRET, SENTRY_DSN, @@ -422,8 +423,6 @@ window.location.href = "/"; if __name__ == "__main__": app = create_app() - app.debug = True - # enable flask toolbar # app.config["DEBUG_TB_PROFILER_ENABLED"] = True # app.config["DEBUG_TB_INTERCEPT_REDIRECTS"] = False