-
Notifications
You must be signed in to change notification settings - Fork 1
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
Opportunity Access model and migrations #41
Conversation
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.
A couple questions on this. It seems like it went a slightly different direction than we discussed on the ticket.
|
||
|
||
class OpportunityAccess(models.Model): | ||
user = models.OneToOneField( |
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 think this should be a key to the actual User model, not ConnectUser
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.
Fixed. 45f8e61
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.
Thanks
commcare_connect/users/models.py
Outdated
@@ -69,3 +69,15 @@ class Role(models.TextChoices): | |||
related_name="memberships", | |||
) | |||
role = models.CharField(max_length=20, choices=Role.choices, default=Role.MEMBER) | |||
|
|||
|
|||
class ConnectUser(BaseModel): |
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.
As I mentioned on the ticket, I don't think these fields are quite right and we should hold off on adding this data until the details of ConnectID/Connect authentication are finished. As mentioned in the other comment, I don't think this is necessary for this PR either.
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.
Removed ConnectUser. 45f8e61
@@ -70,3 +70,18 @@ class DeliverForm(models.Model): | |||
|
|||
def __str__(self): | |||
return self.name | |||
|
|||
|
|||
class OpportunityAccess(models.Model): |
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.
What happened to the other fields on this model? I know we mentioned not creating ones that referenced uncreated models, but some of the fields in the spec were specfic to this one and are still missing. Is that intentional?
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.
The other fields which are not included in this PR include learn_progress
, visit_count
, and last_visit_date
, these are properties that will be computed based on other models i.e. LearnModule and UserVisit models respectively.
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.
date_claimed
is the one I was thinking of. Agree that the others are not necessary yet.
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.
Added. 4ad1eaf
user = models.OneToOneField( | ||
ConnectUser, | ||
on_delete=models.CASCADE, | ||
related_name="claims", |
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 dont think you want to call these claims (default is probably fine, to be honest), since you can have access without yet having claimed the opportunity. In other words, some of these rows represent claims but some do not, so naming them like that is confusing.
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.
Fixed. 4ad1eaf
opportunity = models.ForeignKey( | ||
Opportunity, | ||
on_delete=models.CASCADE, | ||
related_name="claims", |
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.
Same comment about naming
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.
Fixed. 4ad1eaf
@@ -70,3 +70,18 @@ class DeliverForm(models.Model): | |||
|
|||
def __str__(self): | |||
return self.name | |||
|
|||
|
|||
class OpportunityAccess(models.Model): |
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.
date_claimed
is the one I was thinking of. Agree that the others are not necessary yet.
|
||
|
||
class OpportunityAccess(models.Model): | ||
user = models.OneToOneField( |
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.
Thanks
No description provided.