Conversation
Pomax
commented
Oct 5, 2021
| def original_product(self): | ||
| return get_original_by_slug(ProductPage, self.slug) | ||
|
|
||
| def get_or_create_votes(self): |
Contributor
Author
There was a problem hiding this comment.
this just got moved up, so that it's next to the other vote-related function/properties
Pomax
commented
Oct 5, 2021
| class WagtailBuyersGuideVoteTest(APITestCase, BuyersGuideTestMixin): | ||
|
|
||
| def test_successful_vote(self): | ||
| product_page = self.product_page |
Contributor
Author
There was a problem hiding this comment.
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.
TheoChevalier
approved these changes
Oct 5, 2021
Contributor
TheoChevalier
left a comment
There was a problem hiding this comment.
Did some testing with the staging DB, couldn’t spot any issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7502
This gives PNI products an
.original_productaccessor for finding the English version of a product (based on product slug), with a refactor of the code that fetches theDEFAULT_LOCALEandDEFAULT_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
@propertyfunctions forProductPageso 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
unlocalizedfashion, 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-dbto grab a copy of the staging database,inv migratejust to make sure the db is at the tip of our migration chaindocker-compose upand 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-creepinessthat 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 downdocker-compose updata-creepinessvalues