Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-qtype_stack
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_stack
Commits
49b1ad6b
Commit
49b1ad6b
authored
2 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
When removing PRTs, and then adding them back, empty penalties throw notices.
parent
12c1b4fb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
questiontype.php
+21
-9
21 additions, 9 deletions
questiontype.php
with
21 additions
and
9 deletions
questiontype.php
+
21
−
9
View file @
49b1ad6b
...
...
@@ -302,8 +302,13 @@ class qtype_stack extends question_type {
$node
->
quiet
=
$fromform
->
{
$prtname
.
'quiet'
}[
$nodename
];
$node
->
truescoremode
=
$fromform
->
{
$prtname
.
'truescoremode'
}[
$nodename
];
$node
->
truescore
=
$fromform
->
{
$prtname
.
'truescore'
}[
$nodename
];
if
(
property_exists
(
$fromform
,
$prtname
.
'truepenalty'
))
{
$node
->
truepenalty
=
stack_utils
::
fix_approximate_thirds
(
$fromform
->
{
$prtname
.
'truepenalty'
}[
$nodename
]);
}
else
{
// Else we just deleted a PRT.
$node
->
truepenalty
=
''
;
}
$node
->
truenextnode
=
$fromform
->
{
$prtname
.
'truenextnode'
}[
$nodename
];
$node
->
trueanswernote
=
$fromform
->
{
$prtname
.
'trueanswernote'
}[
$nodename
];
$node
->
truefeedback
=
$this
->
import_or_save_files
(
...
...
@@ -312,8 +317,13 @@ class qtype_stack extends question_type {
$node
->
truefeedbackformat
=
$fromform
->
{
$prtname
.
'truefeedback'
}[
$nodename
][
'format'
];
$node
->
falsescoremode
=
$fromform
->
{
$prtname
.
'falsescoremode'
}[
$nodename
];
$node
->
falsescore
=
$fromform
->
{
$prtname
.
'falsescore'
}[
$nodename
];
if
(
property_exists
(
$fromform
,
$prtname
.
'falsepenalty'
))
{
$node
->
falsepenalty
=
stack_utils
::
fix_approximate_thirds
(
$fromform
->
{
$prtname
.
'falsepenalty'
}[
$nodename
]);
}
else
{
// Else we just deleted a PRT.
$node
->
falsepenalty
=
''
;
}
$node
->
falsenextnode
=
$fromform
->
{
$prtname
.
'falsenextnode'
}[
$nodename
];
$node
->
falseanswernote
=
$fromform
->
{
$prtname
.
'falseanswernote'
}[
$nodename
];
$node
->
falsefeedback
=
$this
->
import_or_save_files
(
...
...
@@ -2109,12 +2119,14 @@ class qtype_stack extends question_type {
}
}
if
(
array_key_exists
(
$prtname
.
$branch
.
'penalty'
,
$fromform
))
{
$penalty
=
$fromform
[
$prtname
.
$branch
.
'penalty'
][
$nodekey
];
if
(
''
!=
$penalty
&&
is_numeric
(
$penalty
))
{
if
(
$penalty
<
0
||
$penalty
>
1
)
{
$errors
[
$branchgroup
][]
=
stack_string
(
'penaltyerror2'
);
}
}
}
// Else we have just deleted the PRT.
$answernote
=
$fromform
[
$prtname
.
$branch
.
'answernote'
][
$nodekey
];
if
(
''
==
$answernote
)
{
...
...
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