Skip to content
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

Add insufficient blocks case to code validation #9647

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions webapp/src/components/tutorialValidators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class BlocksExistValidator extends CodeValidatorBase {
const {
missingBlocks,
disabledBlocks,
insufficientBlocks
} = pxt.blocks.validateBlocksExist({
usedBlocks: editor.getAllBlocks(false /* ordered */),
requiredBlockCounts: stepHighlights,
Expand All @@ -81,6 +82,9 @@ export class BlocksExistValidator extends CodeValidatorBase {
} else if (disabledBlocks.length > 0) {
isValid = false;
errorDescription = lf("Make sure your blocks are connected to the rest of your code like this.");
} else if (insufficientBlocks.length > 0) {
isValid = false;
errorDescription = lf("Make sure you have enough blocks and that they're connected to the rest of your code. It should look like this.");
}

const blockImages = stepInfo?.hintContentMd ? (<div>
Expand Down
Loading