Select problem by type - #24
Conversation
There was a problem hiding this comment.
This turns out to be least invasive and complex solution. Alternatives were:
- Add
problem_typeclass method to every CAPA Input type: results in shotgun change - a couple of lines into ~20 classes. - Determine problem name by CAPA input class name: some classes support multiple modes (e.g.
checkboxgroupandradiogroup) - results in three/four exceptions to the rule that cover ~20 cases. Plus the rule itself would be a bit non-trivial - something like "split into words by capital letters, remove stopwords (e.g. Input), join by space, but don't split JS"
On the other hand, this approach have no "moving parts" (i.e. trivial logic), localized and does not require using reflection in production code. I'm going to try covering this method with test that would check if all the CAPA input type tags are present, so it would still be robust to changes/additions/deletions of CAPA input types.
There was a problem hiding this comment.
It's weird that something like this doesn't exist already.
There was a problem hiding this comment.
@bradenmacdonald unfortunately, it doesn't. Labels displayed in "Add XBlock" -> "Problem" menu are names of templates, but since it's possible to have more than one control in a problem there're no such thing as "Problem Type". And controls themselves does not have display names.
ad29a90 to
03a9ebb
Compare
|
@e-kolpakov Two things:
Otherwise, your approach looks good here from what I can see (well, as good as it can be, given that this task is a bit of a hack). |
5aa4397 to
c0998b2
Compare
|
@bradenmacdonald thanks for the hint. I'm trying to do that, but there's a problem - filtering requires CapaProblem introspection. It's available as So, surprisingly, CapaDescriptor does not have |
|
The descriptor needs a reference to a ModuleSystem (the CMS uses from xmodule.tests import get_test_system
child.bind_for_student(get_test_system(), child._field_data)
# Now child.lcp should be accessible...If that's not working and you need the big picture of how these work, check out |
c0afe58 to
102047e
Compare
102047e to
c051785
Compare
|
My only other feedback here is that you have added five new bok choy tests (if you count the ddt variants). I seem to recall Steve or someone else from upstream saying that because bok choy tests are so slow, we should aim for closer to one new bok choy test per story. You may want to try to consolidate these tests somehow. |
82b7bb8 to
0cc3b33
Compare
0f0821c to
ea03428
Compare
There was a problem hiding this comment.
Typo: Variable is called _tas instead of tags
6a6f3c2 to
d6fa6c0
Compare
|
@bradenmacdonald all notes are addressed - thanks for suggestion of using response types rather than input types - it's more intuitive. Please note my comments on "Custom" type though - basically three "Add Component" templates fall into this filter: "Custom Javascript Display and Grading", "Custom Python-Evaluated Input" and (surprisingly) "Drag and Drop" |
d6fa6c0 to
e19e166
Compare
|
@e-kolpakov Sounds good. |
… problems than libraries and filtering allow
8056ce2 to
a487da4
Compare
a487da4 to
9fc92ac
Compare
Internal/temporary PR for review.