-
Notifications
You must be signed in to change notification settings - Fork 21
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
[8381] add unregistered participants field to project insights to account fo… #2830
Conversation
8d086c5
to
3481b63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to keep this PR on-hold and proceed with the fix in a new PR. See my inline comments.
5ed20f2
to
63ad043
Compare
I've updated this with the signal solution to compare now |
63ad043
to
554836c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Can you update the insights docs?
@goapunk there is an error also with the signals import, tests failing |
@m4ra will do, the signal error is because it needs the a4 pr merged first |
554836c
to
1aabe86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some clarifications on how we count active participants
(_("active participants"), insight.active_participants.count()), | ||
( | ||
_("active participants"), | ||
insight.active_participants.count() + insight.unregistered_participants, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here active participants are the sum of both registered and unregistered. But when a poll is submitted by an unregistered user, the active participants are not increased, only the unregistered ones. See my comment below in the signal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
active_participants
is a m2m relation to the user model, so we can't increase it for unregistered users, that's why I added the unregistered_participants
field. And we combine both fields here to reflect the total count of participants (maybe somewhat confusingly still called "active participants").
if creator: | ||
insight.active_participants.add(creator.id) | ||
else: | ||
insight.unregistered_participants += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, shouldn't we also increment the active_participants
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanx for clarifying, LGTM
@goapunk can you update the a4 hash, and add a changelog? I have approved already, so please go ahead and merge once you are done. |
1aabe86
to
d92e768
Compare
@goapunk looks like the project-insight model needs to have the active_participants field as nullable. See the test failing. |
insight.active_participants.add(*ids) | ||
# content from unregistered users doesn't have a creator but a content_id | ||
if model_field_exists(obj.model, "content_id"): | ||
content_ids = set( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now added more generic way of counting the unregistered participants, what do you think ? If that's fine I'd squash this commit and merge it afterwards
@goapunk LGTM. Go ahead with commits squashing and merge |
…r the new feature in the poll module which allows participating without account
8722bfe
to
8e78892
Compare
…r the
new feature in the poll module which allows participating without account
Tasks
depends on liqd/adhocracy4#1688