-
Notifications
You must be signed in to change notification settings - Fork 119
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
Family fix! #1275
Family fix! #1275
Conversation
target_assembly__hash=scratch.target_assembly.hash, | ||
).order_by("creation_time") | ||
else: | ||
family = Scratch.objects.filter(slug=scratch.slug) |
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.
deduplicate this and create a function that returns family
? (letting this caller add an .order_by call)
target_assembly__hash=scratch.target_assembly.hash, | ||
) | ||
else: | ||
family = Scratch.objects.filter(slug=scratch.slug) | ||
|
||
return str(hash((family, request.headers.get("Accept")))) |
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.
It's worth double-checking + adding a test that this actually works as it's supposed to. I wouldn't be surprised if hash() on a query set returns its id(), i.e. pretty much a random number, and that you need to call list() on it or even further serialize it for it to work.
BTW it's also not great that this query is performed twice; once for the etag and once for the content. Maybe it would be faster just to remove the etag.
No description provided.