WeBWorK Main Forum

weight of problems (integers only)

weight of problems (integers only)

by Andras Balogh -
Number of replies: 3

I reassign missed problem sets regularly for half the original credit.

I seem to remember that I was able to assign fractional weights to problems
with previous versions of WeBWorK, but I cannot do it now.
Is there a way for this?

For example, I would like to reduce a weight of 3 to 1.5 on specific problems assigned to specific student.
Entering 1.5 and clicking save resets the weight to 1.

Interesting feature on the other hand that I can assign negative integer weights.

Andras


In reply to Andras Balogh

Re: weight of problems (integers only)

by Gavin LaRose -
Hi Andras,

It looks as if the value field for problems may have gotten converted to INT as of the WeBWorK 2.2 release, though there's a persistent question as a comment in the source code saying "Should value be float instead of text?"

In that it is INT, the possibility of assigning negative weights makes sense. I don't see any reason why the problem value shouldn't be converted to FLOAT in the future (e.g., for the 2.4 release?), but I defer to Mike and Sam on that type of question.

Gavin
In reply to Gavin LaRose

Re: weight of problems (integers only)

by Andras Balogh -
Hi Gavin,

Can't I change this behavior by modifying some files?

The final score can be some percentage of the original score anyway.

Andras

In reply to Andras Balogh

Re: weight of problems (integers only)

by Gavin LaRose -
Hi Andras,

What version of WeBWorK are you using? I'm basing the following on my production server, which is running a strange version that's somewhere around 2.3.

You can change value to a floating point number, but it will require changing the data types in the mySQL database as well as editing some files. If you only have a few courses and have access to the mySQL server, you can change the database tables with the commands

  mysql> alter table `{coursename}_problem` change column value value float;
  mysql> alter table `{coursename}_problem_user` change column value value float;
for each of your courses.

Then, in /opt/www/webwork/lib/WeBWorK/DB/Record (or the equivalent location in your install), change Problem.pm so that the last subroutine is defined as

sub SQL_TYPES {qw(
        BLOB
        INT
        TEXT
        FLOAT
        INT
)}
(which changes the fourth entry from INT to FLOAT) and similarly in UserProblem.pm, change the last subroutine to
sub SQL_TYPES {qw(
        BLOB
        BLOB
        INT
        TEXT
        FLOAT
        INT
        INT
        TEXT
        INT
        TEXT
        INT
        INT
)}
(changing the fifth entry).

I think that should be sufficient to make the update. You'll have to restart apache for WeBWorK to see the changes, of course. (And it might be advisable to stop apache while you're making the update.)

Gavin