We're updating the issue view to help you get more done. 

Blurbs in user pseuds list and collection people list include anonymous and unrevealed works in the count

Description

The user testy's default pseud has 1116 works visible when logged in. However, the blurb in testy's pseud list shows 1164 works, and the blurb in the list of people associated with one of testy's collections also shows 1164 works. There's a similar difference in work counts when logged out: 524 vs. 565. The difference is presumably the number of anonymous and/or unrevealed works.

Both of these pages call Pseud.work_counts_for_pseuds, which relies on the scopes Pseud.public_work_count_for and Pseud.posted_work_count_for. The definitions of these two scopes are:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 scope :public_work_count_for, -> (pseud_ids) { select('pseuds.id, count(pseuds.id) AS work_count') .joins(:works) .where( pseuds: { id: pseud_ids }, works: { posted: true, hidden_by_admin: false, restricted: false } ).group('pseuds.id') } scope :posted_work_count_for, -> (pseud_ids) { select('pseuds.id, count(pseuds.id) AS work_count') .joins(:works) .where( pseuds: { id: pseud_ids }, works: { posted: true, hidden_by_admin: false } ).group('pseuds.id') }

Note that neither scope checks anonymous/unrevealed status.

Environment

None

Status

Assignee

Unassigned

Reporter

ticking instant

Roadmap

Pseuds

Priority

Medium

Affects versions

0.9.249

Fix versions

None

Components

BackEnd

Difficulty

Medium

Required Access Level

None

Milestone

Internal 0.9