WeBWorK Problems

Hints seem to always be shown

Hints seem to always be shown

by Peter Staab -
Number of replies: 2
I am authoring a problem and wanted the student to try the problem twice before viewing a hint. As I understand it, if I add

$showHint = 2;

to the problem. And then add a hint block as

HINT(EV3(<<'END_HINT'));
$BR
$HINT $BR

# hint goes here

END_HINT

then the hint should show up only after the student has attempted the problem twice.

In fact, at the bottom of the hint it says "(Show hint after 2 attempts. )", meaning it seems to be picking up the $showHint variable.

However, the hint is always shown. I have viewed the problem as a student (by acting as a student) and by logging in as a student.

Is this a bug or am I missing something?

Peter
In reply to Peter Staab

Re: Hints seem to always be shown

by Michael Gage -
Hi Peter,

This is a bug and should be fixed in the latest version of PGbasicmacros.pl

You can update by typing

cvs update -A PGbasicmacros.pl


in the directory pg/macros. This will only update the file PGbasicmacros.pl.


The error is probably being caused because you have not defined the variable:

PRINT_FILE_NAMES_PERMISSION_LEVEL

in global.conf and which is currently being used to determine when hints and file paths are shown. perl has assumed the level =0 hence all students get
to see the hints. The new version of PGbasicmacros.pl assigns a value
of 1000 to this variable if it is not defined.

Snippets from global.conf:

# Users for whom to print the file name of the PG file being processed.
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = [ "professor", ];
# ie file paths are printed for 'gage'
$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL} = $userRoles{ $permissionLevels{print_path_to_problem} };
# (file paths are also printed for anyone with this permission or higher)

and

%permissionLevels = (
.....
print_path_to_problem => "professor", # see "Special" PG environment variables
......
)

There is a need to overhaul the entire method of deciding permission levels
inside of problems. In particular should the permission level be that of the actual user or of the effective user (which could be different if the instructor is acting as a student)? The answer of course is "it depends" which is why some thought needs to be put into the upgrading the way permission levels are determined and used. Currently the real user's permission is always used
even when they are acting as a student.


-- Mike




In reply to Michael Gage

Re: Hints seem to always be shown

by Peter Staab -
Mike,

Thanks for your help. The update patch work.

First, its seems like it should "work out of the box" as it does now.

I agree with the "it depends" on the user level. There are times when acting as a student, it would be helpful to have professor level capabilities, but also it would be nice to switch to "student" level and see exactly what they would see. Perhaps a simple toggle between these two.

Peter