diff --git a/docs/source/drag_and_drop_input.rst b/docs/source/drag_and_drop_input.rst index dc13dcfb11..82cb99436a 100644 --- a/docs/source/drag_and_drop_input.rst +++ b/docs/source/drag_and_drop_input.rst @@ -212,6 +212,93 @@ for same number of draggables, anyof is equal to unordered_equal If we have can_reuse=true, than one must use only long form of correct answer. + +Grading logic +------------- + +1. User answer and correct answer populated to the same form:: + + group_id: group_draggables, group_targets, group_rule + +Group_id is ordinal number, for every dict in correct answer incremental +group_id is assigned: 0, 1, 2, ... + +Draggables from user answer are added to same group_id where identical draggables +from correct answer are:: + + If correct_draggables[group_0] = [t1, t2] then + user_draggables[group_0] are all draggables t1 and t2 from user answer: + [t1] or [t1, t2] or [t1, t2, t2] etc.. + +2. For every group user_draggables, if 'number' not in rule, set() is applicated, +if 'number' not in rule, set is not applicated:: + + from [t1, t2, t3, t3] -> [t1, t2, ,t3] + +Set() and 'number' are needed only for case of reusable draggables, +for other cases there are no equal draggables in list, so set() does nothing. + +Usege of set() operation allows easily create rule for case of +``any number of same draggable can be dragged to some targets``:: + + { + 'draggables': ['draggable_1'], + 'targets': ['target3', 'target6', 'target9'], + 'rule': 'anyof' + } + +'number' rule is used for the case of reusable draggables, when one want to +fix number of draggable to drag. In this example only two instances of +draggables_1 are allowed to be dragged:: + + { + 'draggables': ['draggable_1', 'draggable_1'], + 'targets': ['target3', 'target6', 'target9'], + 'rule': 'anyof+number' + } + +Note, that in using rule 'exact', one does not need 'number', because you can't +recognize from user interface which reusable draggable on which target. +Absurd example:: + + { + 'draggables': ['draggable_1', 'draggable_1', 'draggable_2'], + 'targets': ['target3', 'target6', 'target9'], + 'rule': 'exact' + } + + +Correct handling of upper example is create different rule for draggable_1 and +draggable_2 + +For 'unordered_equal' (or 'exact') we not need 'number' if you have only same +draggable in group, as targets length will provide contraing for the number of +draggables:: + + { + 'draggables': ['draggable_1'], + 'targets': ['target3', 'target6', 'target9'], + 'rule': 'unordered_equal' + } + +This means that only three draggaggables 'draggable_1' can be dragged. + +But if you have more that one different reusable draggable in lis, you may use +'number' rule:: + + { + 'draggables': ['draggable_1', 'draggable_1', 'draggable_2'], + 'targets': ['target3', 'target6', 'target9'], + 'rule': 'unordered_equal+number' + } + +If not use number, draggables list will be setted to ['draggable_1', 'draggable_2'] + +For every group, at this step, draggables lists are equal + +3. For every group, lists of targets are compared using rule for that group. + + Logic flow ---------- diff --git a/docs/source/draganddrop_logic_flow.png b/docs/source/draganddrop_logic_flow.png index 5708d36284..2bb1c11a41 100644 Binary files a/docs/source/draganddrop_logic_flow.png and b/docs/source/draganddrop_logic_flow.png differ