Difference between revisions of "Scaffolding1"

From WeBWorK_wiki
Jump to navigation Jump to search
(New scaffolding or sequentially revealed template)
 
m
Line 67: Line 67:
 
Set <code>$isInstructor = 0;</code> when the problem is available to students, or set to 1 when debugging.
 
Set <code>$isInstructor = 0;</code> when the problem is available to students, or set to 1 when debugging.
 
Alternatively, we could set
 
Alternatively, we could set
<code>$isInstructor = ($envir{effectivePermissionLevel} >= $envir{ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL});</code> to ensure that only users that always have permission to show correct answers can open all of the sections of the scaffolding without needing to enter correct answers.
+
<code>$isInstructor = ($envir{effectivePermissionLevel} >= </code><code>$envir{ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL});</code> to ensure that only users that always have permission to show correct answers can open all of the sections of the scaffolding without needing to enter correct answers.
 
</p>
 
</p>
 
</td>
 
</td>

Revision as of 15:02, 29 June 2014

Sequentially Revealed (Scaffolded) Problems

Click to enlarge

This PG code shows how to create multi-part questions that hide from students parts that have not yet been answered correct.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();  
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"compoundProblem5.pl",
"PGcourse.pl",
);

TEXT(beginproblem());
$showPartialCorrectAnswers = 1;

$scaffold = Scaffold();
INITIALIZE_SCAFFOLD('$scaffold');

$isInstructor = 0; # = 0 when students use it

TEXT(MODES(
HTML=>'Clicking on a section opens it 
provided that you have answered previous sections correctly.',
TeX=>''));

Initialization: We initialize the scaffolding with the name $scaffold. Set $isInstructor = 0; when the problem is available to students, or set to 1 when debugging. Alternatively, we could set $isInstructor = ($envir{effectivePermissionLevel} >= $envir{ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL}); to ensure that only users that always have permission to show correct answers can open all of the sections of the scaffolding without needing to enter correct answers.

Context("Numeric");

$answer = Compute("1");

Setup:

Context()->texStrings;
BEGIN_TEXT
Question text
$BR
$BR
Answer =
\{ ans_rule(20) \}
\{ AnswerFormatHelp("formulas") \}
END_TEXT
Context()->normalStrings;

Main Text:

$showPartialCorrectAnswers = 1;

ANS( $answer->cmp() );

Answer Evaluation:

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution:

Templates by Subject Area