WeBWorK Main Forum

weight of problems (integers only)

Re: weight of problems (integers only)

by Gavin LaRose -
Number of replies: 0
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