Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaign view count seems to display invalid values #712

Closed
marcinkunert opened this issue Feb 16, 2022 · 8 comments
Closed

Campaign view count seems to display invalid values #712

marcinkunert opened this issue Feb 16, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@marcinkunert
Copy link
Contributor

Version:

  • listmonk: v2.1.0
  • OS: Docker

I've noticed a weird behaviour in displaying campaign view count.

select count(*) from campaign_views where campaign_id = 9; -- result: 4955
select count(distinct subscriber_id) from campaign_views where campaign_id = 9; -- result: 2830

With individual subscriber tracking enabled.

I've made sure the option is enabled. I've even disabled and enabled it to be sure.

image
Expected 2830, got 4955 (looks like is not counting the distinct value)

image

Expected 2830, got 3564. This seems to be the sum of the day values:

select EXTRACT(day FROM created_at) as day, count(distinct subscriber_id) from campaign_views
where campaign_id = 9
group by EXTRACT(day FROM created_at);

returns

day;count
2;2066
3;792
4;242
5;89
6;71
7;78
8;45
9;51
10;28
11;32
12;16
13;22
14;15
15;16
16;1

after summing up the count: 3564

Without individual subscriber tracking enabled.

image
image

Looks in both list view and detail view.

@marcinkunert marcinkunert added the bug Something isn't working label Feb 16, 2022
@NicoHood
Copy link
Contributor

@knadh Any comment from your side? This issue is currently keeping me from upgrading to the lastest version.

@marcinkunert
Copy link
Contributor Author

@NicoHood these values are being calculated in runtime and are not persisted, so there is not much risk involved in upgrading

@knadh
Copy link
Owner

knadh commented Feb 21, 2022

I am yet to debug this, but like @marcinkunert said, it's just a read query. Has no effect on how data is stored internally.

@knadh
Copy link
Owner

knadh commented Mar 2, 2022

Ah!

SELECT campaign_id, COUNT(%s) AS "count", DATE_TRUNC((SELECT * FROM intval), created_at) AS "timestamp"

The distinct (subscriber_id) applies to each day (GROUP BY timestamp), not the entire group of all days. Glaring miss. Have to change the query so that the it only considers the first occurrence of a subscriber_id across all days.

@NicoHood
Copy link
Contributor

NicoHood commented Mar 2, 2022

Will we see a bugfix release for those fixes, or do we have to wait for a new minor release?

@knadh
Copy link
Owner

knadh commented Mar 2, 2022

These will be fixed and merged to master. You'll be able to run an RC version without waiting for a versioned release.

@NicoHood
Copy link
Contributor

NicoHood commented Mar 2, 2022

I personally would always go for a tagged release. Especially if it is gpg signed ;-) #711

@knadh
Copy link
Owner

knadh commented Mar 2, 2022

RCs can be RC-versioned and GPG signed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants