fix: populate problem weight from max_score when not set #37997
+116
−1
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.
Description
Fixes issue where Studio's edit popup shows incorrect weight for legacy XML problems with multiple sub-problems.
Problem: When importing courses with legacy XML problems containing multiple response fields (e.g., 3 multiple-choice questions), the problem correctly displays "3 points possible" and grades properly, but clicking "Edit" in Studio shows "1 point" instead of "3 points" in the settings popup.
Root Cause: Problems imported without an explicit
weightattribute don't have the field stored in block settings. Theown_metadata()function only returns explicitly set fields, so Studio's edit popup shows the default weight (1) instead of the calculated value frommax_score().Solution: Modified
get_block_info()to populateweightfrommax_score()for problem blocks without explicit weight. This only affects metadata returned for Studio editing, not stored data or grading behavior.Impact:
Supporting information
Fixes #37993
Testing instructions
<multiplechoiceresponse>tags)Unit Tests: