## WeBWorK Problems

### Scaffolding Question Limit Preview to Previously Answered

by Fabian Gabel -
Number of replies: 6

I am currently getting familiar with problems using Scaffolding.po (see the attached .pg file). I want to split a sample problem on matrix multiplication, into two (possibly scaffolded) parts:

1. Given matrices A and B, determine the size of the Matrix C = A * B

2. (if 1 was answered correctly): Give the actual result of the multiplication.

The problems is the following (see the attached screenshot): While previewing the answer for part 1, the matrix structure needed for part 2 is already revealed, even though the part 2 is not visible yet.

Do you have an idea of how to fix this problem, or an even better approach?

Best wishes, Fabian

### Re: Scaffolding Question Limit Preview to Previously Answered

by Nathan Wallach -

I'm working on a feature to restrict what Preview will open for very similar reasons.

You can find the current code at https://github.com/openwebwork/pg/pull/506 .

I'm not sure the current version will be merged into WW 2.16, as it created a hidden form field which can be maliciously abused. Adding security to prevent that tampering will take some effort, but is something I intend to work on later on.

However, as I believe most students are not likely to attempt to hack the problems in that manner - I intend to use this code on my server.

### Re: Scaffolding Question Limit Preview to Previously Answered

by Glenn Rice -

Nathan:  I don't think that your pull request will completely address the issue describe here.  This issue also occurs when the student actually submits the answer.  Not only when previewing the answer (as Fabian stated).

My point is that when the student submits the answer for the first part, the second part will be shown, and the results table will show what is shown in the screen shot, even if the student has not answered the second part.

### Re: Scaffolding Question Limit Preview to Previously Answered

by Glenn Rice -
One way to fix this would be to change line 468 of scaffold.pl from

my @styles = (map {".attemptResults > tbody > tr:nth-child($_) {opacity:.5}"} @hide); to my @styles = (map {".attemptResults > tbody > tr:nth-child($_) {display:none}"} @hide);

as suggested in the comments above this line.

You could copy /opt/webwork/pg/macros/scaffold.pl into your course macro directory, and make these changes in the copy.  That file will then be used instead of the on in pg/macros.

### Re: Scaffolding Question Limit Preview to Previously Answered

by Fabian Gabel -

Thank you Glenn and Nathan for your quick and helpful replies. I ended up using a combination of both of your suggestions to resolve the issue stated in the header of my initial post!

### Re: Scaffolding Question Limit Preview to Previously Answered

by Fabian Gabel -

Dear all,

apparently the suggestions above for the scaffolding module, don't apply to GateWay quizzes.

As you can see from the screenshot below, the student has access to all parts of the problem right away.

Is there a possibility to implement a 'submit' button to evaluate a part of the student's answer and to open subsequent parts of the problem?

The motivation behind all this, is to offer immediate feedback to the student while doing the quiz.

Best wishes, Fabian

Tags:

### Re: Scaffolding Question Limit Preview to Previously Answered

by Glenn Rice -
With the current implementation, all scaffolds are open in Gateway quizzes. The scaffold.pl macro looks for the environment variable effectivePermissionLevel, and if that variable is not set then it opens all scaffolds. It does this so that all scaffolds will be open in the library browser, which does not set that variable. However, Gateway quizzes also don't set that variable. I actually like that in the way that I use scaffolds, as I only allow one submission for the test. You presumably are allowing multiple submissions. You could change line 273 of scaffold.pl from

our $isLibrary = ($main::envir{effectivePermissionLevel} eq "");

to

our $isLibrary = 0; You will also need to change the next several lines from our$isInstructor = ( .... );

to

our \$isInstructor = 0;

Of course then not all scaffolds will be open in the library browser (and homework sets editor).  Furthermore, you will not have all scaffolds open when you view scaffolding problems.

Although, I don't really recommend this approach.