-
Notifications
You must be signed in to change notification settings - Fork 153
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
Fix POST handling of localized PNI products #7555
Conversation
def original_product(self): | ||
return get_original_by_slug(ProductPage, self.slug) | ||
|
||
def get_or_create_votes(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.
this just got moved up, so that it's next to the other vote-related function/properties
@@ -375,33 +375,35 @@ def test_get_or_create_votes(self): | |||
class WagtailBuyersGuideVoteTest(APITestCase, BuyersGuideTestMixin): | |||
|
|||
def test_successful_vote(self): | |||
product_page = self.product_page |
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.
This is basically a noop refactor, I thought I would be able to add tests in this PR, but it turns out that's much more work, so I filed #7559 to tackle that monster.
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.
Did some testing with the staging DB, couldn’t spot any issue
Closes #7502
This gives PNI products an
.original_product
accessor for finding the English version of a product (based on product slug), with a refactor of the code that fetches theDEFAULT_LOCALE
andDEFAULT_LOCALE_ID
, which are required to make sure that we can find the original English version of products. We didn't have "one place to get them" so there were a bunch of files that all reinvented the wheel, all of those now use the same function to get default locale information.This also update some of the
@property
functions forProductPage
so that total votes and creepiness are derived from the original product, and not a localized alias/published version of that product, both of which are used in the average-creepiness calculation for ranking items on the homepage/category pages.Finally, it makes sure to always template the creepiness value into the product page in an
unlocalized
fashion, so that the JS that hooks into it doesn't get confused by numbers that use commas instead of period for decimal points.Bad case STR:
inv copy-stage-db
to grab a copy of the staging database,inv migrate
just to make sure the db is at the tip of our migration chaindocker-compose up
and load up http://localhost:8000/en/privacynotincluded/categories/video-call-apps/ as well as http://localhost:8000/fr/privacynotincluded/categories/video-call-apps/ in two tabsThis will show a different ordering, where on the English page, you should see Threema, Signal, FaceTime, and Jitsi Meet as top four, whereas on the French page, there are very different elements at the top.
<figure...>
elements that havedata-creepiness
that starts at ~13 and ends at ~82 for the English page0,10660980810234541
(or similar), with comma instead of period, and end at98,6
(or similar), again with comma.Fixed case STR:
docker-compose down
docker-compose up
data-creepiness
values