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

Teacher tool: Initial validation logic #9823

Merged
merged 4 commits into from
Jan 12, 2024
Merged

Teacher tool: Initial validation logic #9823

merged 4 commits into from
Jan 12, 2024

Conversation

kimprice
Copy link
Contributor

Big thanks to @thsparks for helping me get this set up.

Currently, the validation works for BlockCheckCriteria only. It takes the rubric and sets the required block counts for each block id. Then it runs the validateBlocksExist function for each set of blocks in the rubric.

Upload target: https://arcade.makecode.com/app/5df94cd2b924c898ff9960973789eff8048cc4c5-2776605799--eval
Sample share link: https://arcade.makecode.com/S42128-59682-77192-60950
Sample rubric:

{
    "criteria": [
        {
            "displayText": "One or more custom functions that must be called",
            "criteriaId": "blockCheck",
            "blockRequirements": [
                {
                    "blocks": ["function_call", "function_call_output"],
                    "count": 1
                },
                {
                    "blocks": ["function_def"],
                    "count": 1
                }
            ]
        },
        {
            "displayText": "Two different kinds of loops used",
            "criteriaId": "blockCheck",
            "blockRequirements": [
                {
                    "blocks": ["controls_repeat_ext", "device_while", "pxt_controls_for", "pxt_controls_for_of"],
                    "count": 2
                }
            ]
        }
    ]
}

@kimprice kimprice requested a review from a team January 11, 2024 22:57
Copy link
Collaborator

@eanders-ms eanders-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Co-authored-by: Eric Anderson <[email protected]>
@@ -4038,6 +4038,14 @@ export class ProjectView
});
}

async getBlocksAsync(): Promise<Blockly.Block[]> {
if (!this.isBlocksActive()) {
await this.openBlocksAsync();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should just throw an error in this case rather than switch to blocks. Having that switch be a side-effect of another call feels like it could lead to some unwanted behavior...plus, if we throw an error instead of switching, this function doesn't have to be async :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

Co-authored-by: Thomas Sparks <[email protected]>
Copy link
Contributor

@thsparks thsparks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thought about perhaps throwing an error rather than having a switch-to-blocks side effect on that getBlocksAsync call. Otherwise LGTM!

@kimprice kimprice merged commit fe3f3b4 into master Jan 12, 2024
6 checks passed
@kimprice kimprice deleted the kim-valProject branch January 12, 2024 00:41
Copy link
Contributor

@thsparks thsparks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants