Skip to content

Email instance view can show inconsistent open stats #122

@cjg89

Description

@cjg89

Describe the bug

Email instance views can occasionally show inconsistent open counts on a single page load, due to {{instance.initial_opens}} being re-evaluated each time it's called.

<strong class="lead font-weight-black">{{instance.initial_opens}}</strong>
</div>
<div class="col-4 d-flex flex-column justify-content-between">
<h4 class="font-weight-bold small text-uppercase">Open Rate</h4>
<strong class="lead font-weight-black text-info-aw">{{instance.open_rate}}%</strong>
</div>
</div>
<p class="small pt-3 mb-3">Of the <strong>{{instance.recipient_details.count}}</strong> recipients, <strong >{{instance.initial_opens}}</strong> opened the email. An open rate of <strong>{{instance.open_rate}}%</strong>.</p>

{{instance.click_recipient_count}} likely has the same issue.

Steps to Reproduce

  1. Open an instance view of an email that's recently sent to a lot of people
  2. Refresh until something like this happens
    Screen Shot 2021-08-23 at 4 45 39 PM

Expected Behavior

Stats like this should be consistent wherever they're printed on the page.

Possible Fix

Look into caching/storing property values like this to prevent them from being looked up multiple times on load. lru caching, custom template variables, {% with %} usage could be worth looking into

Your environment:

n/a

Additional context

n/a

Metadata

Metadata

Labels

bugA problem with existing functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions