-
Notifications
You must be signed in to change notification settings - Fork 6
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
apps//settings: add votes app with models #3978
Conversation
Coverage reportTotal coverage
Report generated by 🧪jest coverage report action from c906457 |
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.
So cool!
I think we can merge?!
Module, | ||
on_delete=models.CASCADE | ||
) | ||
allowed_votes = models.PositiveSmallIntegerField( |
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.
Maybe this should go to the module? But we can also change it later/if need be.
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.
Yes, you are right, that should probably eventually go to the module. I just didnt really dare to add it to all modules in A4 😬 But lets keep that in mind once we think about the generating of the tokens?
return TokenVote.objects.filter(token=self) | ||
|
||
@property | ||
def num_votes_left(self): |
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.
On the other hand, this is cool! So, maybe we also just keep the allowed_votes here. Even though, we will also need them in the module to set them here... We could then get this property from the module instead. But anyway, that is not that important now.
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.
We could then just do return self.module.allowed_votes - num_votes
here
To test you first need a 3 phase bürgerhaushalt. You can add a token in django-admin for this module.
The TokenVote cannot be added in django-admin due to the generic foreign key. So you need to do that in the django-shell.