diff --git a/hc/accounts/admin.py b/hc/accounts/admin.py index 4b573b5b..1c019e5a 100644 --- a/hc/accounts/admin.py +++ b/hc/accounts/admin.py @@ -8,7 +8,8 @@ from hc.api.models import Channel, Check @admin.register(Profile) class ProfileAdmin(admin.ModelAdmin): - list_display = ("id", "email", "reports_allowed", "next_report_date") + list_display = ("id", "email", "reports_allowed", "next_report_date", + "ping_log_limit") search_fields = ["user__email"] def email(self, obj): diff --git a/hc/front/views.py b/hc/front/views.py index 44c3efa4..312820f8 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -215,19 +215,24 @@ def log(request, code): # Fill in "missed ping" placeholders: expected_date = older.created + check.timeout - limit = 0 - while expected_date + check.grace < newer.created and limit < 10: + n_blanks = 0 + while expected_date + check.grace < newer.created and n_blanks < 10: wrapped.append({"placeholder_date": expected_date}) expected_date = expected_date + check.timeout - limit += 1 + n_blanks += 1 # Prepare early flag for next ping to come early = older.created + check.timeout > newer.created + check.grace + reached_limit = len(pings) > limit + wrapped.reverse() ctx = { "check": check, - "pings": wrapped + "pings": wrapped, + "num_pings": len(pings), + "limit": limit, + "show_limit_notice": reached_limit and settings.USE_PAYMENTS } return render(request, "front/log.html", ctx) diff --git a/templates/front/log.html b/templates/front/log.html index ea89c295..1a515631 100644 --- a/templates/front/log.html +++ b/templates/front/log.html @@ -87,6 +87,17 @@ {% endif %} {% endfor %} + + {% if show_limit_notice and limit < 10000 %} +

+ Showing last {{ limit }} pings. + Want to see more? + + Upgrade your account! + +

+ {% endif %} + {% else %}
Log is empty. This check has not received any pings yet.