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 isBeta challenges displaying without title when they should be hidden #12989
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.
Some great work here, just a few pointers for keeping it functional 😃
block: Object.keys(blocks) | ||
.map(dashedName => { | ||
const block = blocks[dashedName]; | ||
let challenges = block.challenges; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
.filter(filter) | ||
.map(challenge => challenge.dashedName); | ||
} | ||
block.challenges = challenges; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
.map(dashedName => { | ||
const block = blocks[dashedName]; | ||
let challenges = block.challenges; | ||
if (Array.isArray(challenges)) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -657,7 +657,6 @@ | |||
], | |||
"type": "bonfire", | |||
"isRequired": true, | |||
"isBeta": true, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
930696d
to
7212f15
Compare
@Bouncey Thank you so much for reviewing! I'm sorry for taking so long, I've been a bit absent in the past two weeks and I completely forgot about this. I just pushed the requested updates. How are things now? |
@Bouncey @BerkeleyTrue Can you review? |
@Bouncey @BerkeleyTrue A review would be great! |
@@ -657,7 +657,6 @@ | |||
], | |||
"type": "bonfire", | |||
"isRequired": true, | |||
"isBeta": true, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@systimotic Sorry about that. I had requested changes a while back but I had failed to submit them. |
@systimotic updated the pull request. |
7212f15
to
52f63f5
Compare
@BerkeleyTrue No worries! |
.forEach(block => { | ||
const challenges = actual.block[block].challenges; | ||
challenges.forEach(challenge => challengesFromBlocks.push(challenge)); | ||
}); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Object.keys(actual.block) | ||
.forEach(block => { | ||
challengesFromBlocksCount += actual.block[block].challenges.length; | ||
}); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
.forEach(block => { | ||
challengesFromBlocksCount += actual.block[block].challenges.length; | ||
}); | ||
console.log(challengesFromBlocksCount, actual.block); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@systimotic This PR would also fix the new issue #15705. Do you plan to update this or do you want to start from scratch now that there have been a few updates to the base? I can take a stab at it as well, but looks like you're already a bit farther down the road to solving it. |
@systimotic updated the pull request. |
52f63f5
to
526e932
Compare
common/app/redux/utils.js
Outdated
@@ -10,12 +10,30 @@ export function filterComingSoonBetaChallenge( | |||
} | |||
|
|||
export function filterComingSoonBetaFromEntities( | |||
{ challenge: challengeMap, ...rest }, | |||
{ challenge: challengeMap, block: blocks, ...rest }, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@systimotic Thanks for the PR. I think this will do for now (other than my nit pick above). The issue with this approach is now all the challenges are iterated through twice in addition to the blocks. We now have over 400 challenges and 60+ blocks, so this function went from iterating 400+ times to more like 900+ times. This is a very costly function now. Not your fault, but we will need to come up with a more integrated solution that does not involving iterating through all the challenges and instead filters out during nextChallenge and map rendering. Other than the nitpick above code LGTM. If someone could run it and verify it's ready to merge. |
526e932
to
2c6f5fd
Compare
@systimotic updated the pull request. |
@BerkeleyTrue Yeah, it's not ideal. Should we stick with the workaround from #15741 instead? Also, previously you mentioned some loops in the tests should be changed to |
Merged!!! 0129116 Happy Coding! |
Pre-Submission Checklist
staging
branch of freeCodeCamp.fix/
,feature/
, ortranslate/
(e.g.fix/signin-issue
)npm test
. Usegit commit --amend
to amend any fixes.Type of Change
Checklist:
Closes Missing Challenges #12941
Closes [beta][UI] Missing challenge in Map, Slice and Splice #12842
Original: Map has missing challenges #11547
Description
Woo! So this is probably the biggest change I have made to date. A lot of hours went into understanding what's going on here.
Challenges with
isBeta: true
would display in production, but without title.This was because the challenges weren't being filtered from the blocks. The titles were taken from the
searchNames
, which were filtered, so no title showed up.@BerkeleyTrue This is my first time making a change this "major", and my first time changing the tests. Your review would be much appreciated.