-
Notifications
You must be signed in to change notification settings - Fork 0
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
ensure the user field in categorizers table is one to one #148
Conversation
ponder/models.py
Outdated
@@ -62,7 +62,8 @@ def email_categorizer(self): | |||
class Categorizer(models.Model): | |||
name = models.CharField(unique=True, max_length=254) | |||
initials = models.CharField(unique=True, max_length=3) | |||
user = models.CharField(max_length=254) | |||
#user = models.CharField(max_length=254) |
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.
Can remove this line instead of commenting.
@ZhongweiL Are we ready to merge this? |
@khatchad Yes. |
Didn't we discuss tests? |
I was going to create another PR for that, but I can do that in this branch if you want. |
Add comments.
Comments.
Initials should be unique.
Clarify tests.
More comments.
Remove comment.
@mZneit We can't get the tests to run for this PR but the changes seem good to us. Please review and merge. Thanks,. |
@khatchad This seems to be a MySQL issue. Some tests ran when changes were applied to the database directly, but when applying the same changes using django code, they had no effect in MySQL. |
Hm. But, since you've merged this change, the tests are passing. Are they running but have no effect? |
Ah, actually there are failing. See: https://github.com/ponder-lab/Imperative-DL-Study-Web-App/runs/4377336364?check_suite_focus=true |
@ZhongweiL Looks like your test |
@khatchad From this answer, it seems like Django wraps each test into a transaction, and Django prevents any ORM operation in the same transaction after an exception is thrown. The code can be fixed by deleting the last two assertions in the function. Another way to solve it is to use the solution in the post which is to limit the scope of the transaction to just that one line, the code would look like this:
which will fail the test if the exception was not thrown, and does nothing if it was thrown. But this time the last two assertions can be run because they are not in the same transaction as the categorizer insertion. But I don't think the second solution is necessary unless we really want to keep the last two assertions. |
Intends to resolve issue #147 and #132.