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

remaining_invites is ambiguous #56

Open
palm86 opened this issue Aug 12, 2014 · 2 comments
Open

remaining_invites is ambiguous #56

palm86 opened this issue Aug 12, 2014 · 2 comments

Comments

@palm86
Copy link
Contributor

palm86 commented Aug 12, 2014

It is not clear to me how one determines the number of remaining invites a user has. The method remaining_invites subtracts invited_users.count() from max_invites, so that only accepted invites will be taken into account. What if you want to limit a users invitations whether they are accepted or not?

A better way would be to subtract invitation_set.count() from max_invites, so that all invites, whether accepted or not counts towards a user's total invites sent.

Moreover, one would think that num_invites is always up to date, but it is only updated in the middleware, not upon saving an InvitationCode.

What am I missing?

@yesimon
Copy link
Collaborator

yesimon commented Aug 13, 2014

Yes on both counts. I put it in as kind of a half-baked idea. But now that the model's been around for a while, it's good to get num_invites to be always correct. I'll try to put in a fix.

@devangmundhra
Copy link

+1 for this issue. It would be nice to have a correct count of remaining invites. Updating num_invites when saving an invitation could fix this issue.
I can send a PR for this if we can converge on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants