Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Moodle Qtype Moopt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
Moodle Qtype Moopt
Commits
ac928505
Commit
ac928505
authored
2 years ago
by
root
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into dev/isabel_156
parents
f359ecf6
ce1f6877
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/utility/proforma_xml/grading_scheme_handler.php
+8
-3
8 additions, 3 deletions
classes/utility/proforma_xml/grading_scheme_handler.php
classes/utility/proforma_xml/separate_feedback_handler.php
+46
-9
46 additions, 9 deletions
classes/utility/proforma_xml/separate_feedback_handler.php
with
54 additions
and
12 deletions
classes/utility/proforma_xml/grading_scheme_handler.php
+
8
−
3
View file @
ac928505
...
...
@@ -238,9 +238,14 @@ class grading_scheme_handler {
private
function
fill_grading_hints_node_with_testref_infos
(
\DOMElement
$elem
,
grading_hints_node
$node
)
{
$refid
=
$elem
->
getAttribute
(
'ref'
);
if
((
$titlelist
=
$elem
->
getElementsByTagNameNS
(
$this
->
namespace
,
'title'
))
->
length
==
1
)
{
$node
->
set_title
(
$titlelist
[
0
]
->
nodeValue
);
}
else
{
$foundTitle
=
false
;
foreach
(
$elem
->
childNodes
as
$child
)
{
if
(
$child
->
localName
==
'title'
)
{
$node
->
set_title
(
$child
->
nodeValue
);
$foundTitle
=
true
;
}
}
if
(
!
$foundTitle
)
{
$node
->
set_title
(
$this
->
tests
[
$refid
]
!==
null
&&
$this
->
tests
[
$refid
]
->
getElementsByTagNameNS
(
$this
->
namespace
,
'title'
)[
0
]
->
nodeValue
);
}
if
((
$list
=
$elem
->
getElementsByTagNameNS
(
$this
->
namespace
,
'description'
))
->
length
==
1
)
{
...
...
This diff is collapsed.
Click to expand it.
classes/utility/proforma_xml/separate_feedback_handler.php
+
46
−
9
View file @
ac928505
...
...
@@ -257,20 +257,54 @@ class separate_feedback_handler {
$gradinghintsnode
->
getSeparateFeedbackData
()
->
set_has_internal_error
(
$result
->
getAttribute
(
'is-internal-error'
)
==
"true"
);
}
$gradinghintsnode
->
getSeparateFeedbackData
()
->
set_rawscore
(
$rawscore
);
// Execute functions and only later set score to 0 because the above functions also fills the feedback elements.
if
(
$this
->
should_be_nullified_node
(
$gradinghintsnode
))
{
$
raw
score
=
0
;
$score
=
0
;
$gradinghintsnode
->
getSeparateFeedbackData
()
->
set_nullified
(
true
);
}
$gradinghintsnode
->
getSeparateFeedbackData
()
->
set_rawscore
(
$rawscore
);
}
else
{
$score
=
$rawscore
*
$gradinghintsnode
->
get_weight
()
*
$this
->
scorecompensationfactor
;
}
$gradinghintsnode
->
getSeparateFeedbackData
()
->
set_score
(
$score
);
return
$score
;
}
/**
* Only calculates the score of a given node and does not manipulate any data of the grading hints tree
* @param grading_hints_node $node The root of the subtree
* @param bool $scalescoretolms
* @return float
*/
private
function
calc_score_from_children
(
grading_hints_node
$node
)
:
float
{
list
(
"maxvalue"
=>
$value
,
"mergefunc"
=>
$mergefunc
)
=
$this
->
get_merge_variables
(
$node
->
get_accumulator_function
());
foreach
(
$node
->
get_children
()
as
$id
=>
$child
)
{
if
(
!
$child
->
has_feedback_data
())
{
// if the node was not processed already
$child
->
addSeparateFeedbackData
();
}
if
(
$child
->
get_type
()
===
'test'
)
{
$score
=
$child
->
getSeparateFeedbackData
()
->
get_score
();
if
(
$score
===
null
)
{
// if the test node was not processed already, process it now
$this
->
fill_test_node_with_feedback_data
(
$child
);
$score
=
$child
->
getSeparateFeedbackData
()
->
get_score
();
}
$value
=
$mergefunc
(
$value
,
$score
);
}
elseif
(
$child
->
get_type
()
===
'combine'
)
{
if
(
$this
->
should_be_nullified_node
(
$child
))
{
$score
=
0
;
$child
->
getSeparateFeedbackData
()
->
set_nullified
(
true
);
}
else
{
$score
=
$this
->
calc_score_from_children
(
$child
);
}
$value
=
$mergefunc
(
$value
,
$score
);
}
}
return
$value
;
}
private
function
fill_feedback_node_with_testresult_infos
(
separate_feedback_text_node
$node
,
?
\DOMElement
$testresult
)
{
if
(
isset
(
$testresult
))
{
...
...
@@ -443,7 +477,12 @@ class separate_feedback_handler {
private
function
get_nullify_combine_value
(
grading_hints_nullify_condition_combineref_operand
$operand
):
float
{
$refid
=
$operand
->
get_ref
();
$gradinghintsnode
=
$this
->
detailedfeedback
->
get_child_by_refid
(
$refid
);
return
$gradinghintsnode
->
getSeparateFeedbackData
()
->
get_score
();
if
(
$gradinghintsnode
->
has_feedback_data
())
{
$score
=
$gradinghintsnode
->
getSeparateFeedbackData
()
->
get_rawscore
();
}
else
{
$score
=
$this
->
calc_score_from_children
(
$gradinghintsnode
);
}
return
$score
;
}
/**
...
...
@@ -458,9 +497,7 @@ class separate_feedback_handler {
}
else
{
$testresult
=
$this
->
testresults
[
$refid
];
}
$score
=
$testresult
->
getElementsByTagNameNS
(
$this
->
namespacefeedback
,
'result'
)[
0
]
->
getElementsByTagNameNS
(
$this
->
namespacefeedback
,
'score'
)[
0
]
->
nodeValue
;
return
$score
;
return
$testresult
->
getElementsByTagNameNS
(
$this
->
namespacefeedback
,
'result'
)[
0
]
->
getElementsByTagNameNS
(
$this
->
namespacefeedback
,
'score'
)[
0
]
->
nodeValue
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment