mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Added reset for link click count on edit
refs https://github.com/TryGhost/Team/issues/2104 When a newsletter link is edited, we reset its click count to 0 to show only the clicks on newly edited links. This is done by only counting the member click events for a link which are greater than its last updated at, so that all previous click events are not counted for the link, but are included in the total count of all links on the page.
This commit is contained in:
parent
d8bacf12d1
commit
6312b064f5
1 changed files with 1 additions and 0 deletions
|
@ -53,6 +53,7 @@ const Redirect = ghostBookshelf.Model.extend({
|
|||
qb.countDistinct('members_click_events.member_id')
|
||||
.from('members_click_events')
|
||||
.whereRaw('redirects.id = members_click_events.redirect_id')
|
||||
.whereRaw('redirects.updated_at <= members_click_events.created_at')
|
||||
.as('count__clicks');
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue