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

Forward auto-grading settings to DL assignments #6641

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Sep 3, 2024

For:

Deep linking summary:

  • The frontend calls the deep_linking_fields API with the assignment's config.
  • The BE returns a JWT that must be POSTed to the LMS client side.
  • That JWT contains an encoded representation of the assigned configuration. Some of those elements are encoded in and URL other are port of the launch's custom parameters.
  • The client POSTs the config the LMS, the assignment is created
  • Next launches of the assignments forward to us the configuration.

This PR handles encoding the auto grading configuration as part of the deep linked parameters.

Next steps will need to read it on launches and persist it to the DB.

Testing

diff --git a/lms/views/lti/basic_launch.py b/lms/views/lti/basic_launch.py
index b2404a85b..c40859098 100644
--- a/lms/views/lti/basic_launch.py
+++ b/lms/views/lti/basic_launch.py
@@ -81,6 +81,11 @@ class BasicLaunchViews:
                     request=self.request, type_=LTIEvent.Type.CONFIGURED_LAUNCH
                 )
             )
+            print(
+                self.request.lti_params.v13.get(
+                    "https://purl.imsglobal.org/spec/lti/claim/custom"
+                )
+            )
             return {}
 
         # Show the file-picker for the user to choose a document.

)

required_annotations = fields.Int(
required=False, allow_none=True, validate=validate.Range(min=0)
Copy link
Member Author

Choose a reason for hiding this comment

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

min=1?

@marcospri marcospri mentioned this pull request Sep 4, 2024
2 tasks
@acelaya acelaya force-pushed the auto-grading-config branch 4 times, most recently from e25c841 to 23e49b8 Compare September 4, 2024 10:22
@marcospri marcospri force-pushed the store-auto-grading-deep-linking branch 2 times, most recently from ebd9a53 to 796a974 Compare September 4, 2024 10:45
@marcospri marcospri marked this pull request as ready for review September 4, 2024 10:46
@marcospri marcospri requested a review from acelaya September 4, 2024 10:48
@marcospri marcospri force-pushed the store-auto-grading-deep-linking branch from 796a974 to bbebde4 Compare September 4, 2024 10:50
grading_type = fields.Str(
required=True, validate=validate.OneOf(["all_or_nothing", "scaled"])
)
activity_calculation = fields.Str(
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed this to "separate"

@acelaya acelaya force-pushed the auto-grading-config branch from 23e49b8 to bf7bb91 Compare September 4, 2024 11:45
Base automatically changed from auto-grading-config to main September 4, 2024 11:49
@marcospri marcospri force-pushed the store-auto-grading-deep-linking branch from bbebde4 to f1d5893 Compare September 4, 2024 12:42
required=True, validate=validate.OneOf(["cumulative", "separate"])
)

required_annotations = fields.Int(required=True, validate=validate.Range(min=0))
Copy link
Member Author

Choose a reason for hiding this comment

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

required_annotations always required

Copy link
Contributor

@acelaya acelaya left a comment

Choose a reason for hiding this comment

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

I noticed the tests are only covering the usage of invalid values, but in that case I would expect the test to fail.

@@ -211,6 +211,10 @@ def test_it_for_v11(
{"group_set": "1", "title": "title"},
{"group_set": "1", "title": "title"},
),
(
{"auto_grading_config": {"key": "value"}},
{"auto_grading_config": '{"key": "value"}'},
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we not validating that this fulfills _AutoGradingConfig definition? 🤔

I would expect these values to be invalid.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good point but I'm afraid I don't a satisfactory answer.

The method here is unaware of the types, it just passes along what it receives, and in the case of these settings it serlizes it as json. That's what the test does. I included the private name of the method in the test name (one extra _)

The marshmallow schema is validated before we get into the the code of individual views and it gets serialized into request.parsed_params, if that not valid the view is never called.

That being said I added a very broad valid/invalid tests for the schema itself 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

The marshmallow schema is validated before we get into the the code of individual views and it gets serialized into request.parsed_params, if that not valid the view is never called.

Oh, I see 👍🏼

@marcospri marcospri force-pushed the store-auto-grading-deep-linking branch from f1d5893 to 88e5b0d Compare September 4, 2024 14:47
from tests import factories


class TestDeepLinkingFieldsRequestSchema:
Copy link
Member Author

Choose a reason for hiding this comment

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

Testing just the schema here.

"content_item_return_url": "return_url",
"auto_grading_config": {
"grading_type": "scaled",
"activity_calculation": "RANDOM",
Copy link
Member Author

Choose a reason for hiding this comment

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

Best type of grading

],
)
def test_get_assignment_configuration(
def test__get_assignment_configuration(
Copy link
Member Author

@marcospri marcospri Sep 4, 2024

Choose a reason for hiding this comment

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

Fixed this test's name, it testing _get_assignment_configuration not get_assignment_configuration

@marcospri marcospri requested a review from acelaya September 4, 2024 14:54
@marcospri marcospri merged commit b7f7bea into main Sep 9, 2024
9 checks passed
@marcospri marcospri deleted the store-auto-grading-deep-linking branch September 9, 2024 07:52
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.

2 participants