### Could not get an uncategorized id!

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Could not get an uncategorized id!

Hiya All,

I have encoutered a rarther strange error on the gradebook. When I enter, I get "Could not get an uncategorized id!" so i turned debugging on and recieved this.

-----------------------------------------------------------------------------------

Out of range value adjusted for column 'weight' at row 1

INSERT INTO mdl_grade_category ( NAME, COURSEID, DROP_X_LOWEST, BONUS_POINTS, HIDDEN, WEIGHT ) VALUES ( 'uncategorised', 2, 0, 0, 0, 100 )

-----------------------------------------------------------------------------------

I am on a Windows Server 2003 system with IIS.6, PHP 5.1.2, MySQL DB 5.0.18, runs like a dream. This is the one thing we use the most here, and it doesent work.

I have searched the site and found numerous solutions and followed steps, but... to no such luck. I'me not great on MySQL, must start learning it soon.... Any help would be much appreciated. Ime on Moodle 1.5.3 Stable Branch. I picked up this code from the mysql.php file under the lib/db file in Moodle:

}

if ($oldversion < 2005032800) { execute_sql("CREATE TABLE {$CFG->prefix}grade_category (

id int(10) unsigned NOT NULL auto_increment,

name varchar(64) default NULL,

courseid int(10) unsigned NOT NULL default '0',

drop_x_lowest int(10) unsigned NOT NULL default '0',

bonus_points int(10) unsigned NOT NULL default '0',

hidden int(10) unsigned NOT NULL default '0',

weight decimal(4,2) default '0.00',

PRIMARY KEY (id),

KEY courseid (courseid)

) TYPE=MyISAM ;");

Josh

Re: Could not get an uncategorized id!

Hi All,

As an update, I have tried and tested the 1.6 Development edition instead. To no avail, still the same error pops up. Could it be a MySQL configuration problem or a PHP one? It must be something along those lines or the way I set It up. But I followed all instructions clearly and i'me at a loss.

Josh

Re: Could not get an uncategorized id!
Hi Josh, could I ask for more details:

I sounds like you were using the gradebook for a while and then the error appeared?

Was there an upgrade of the server or Moodle before the error appeared?
Did you install any non-standard modules?
What graded activities are in use in the course where the error appeared?
Re: Could not get an uncategorized id!

Hi, Its fixed now but of course!

• The Gradebook error had been there on a clean install as I reinstalled twice, deleteing database and everything in its path.
• There was no upgrade to moodle or the server
• I did Install Filemanager 2 and Messaging Enhancements, but it still did it before, I believe, I even installed 1.6 dev of moodle without these modules, and still the error came up.
• There were no graded activities at that time under that course, it happend in all courses.

Thanks for posting, and apreciate your help anyway.

Cheers,

Josh

Re: Could not get an uncategorized id!

FIXED!! There seems to be an issue with Moodle 1.5.3 Stable Branch and 1.6 Development edition with MySQL Server 5.0.18.

Solution/Temp Fix: Downgrade MySQL DB Server 5.0.18 to 4.1.18. Uninstall 5.0.18 and Install 4.1.18, you can get 4.1.18 here.

Also this error can be caused if the mdl_grade_category table doesen't exist!

Re: Could not get an uncategorized id!

Hi Josh,

From the MySQL 5.0 reference manual (emphasis added);
salary DECIMAL(5,2)
Standard SQL requires that the salary column be able to store any value with five digits and two decimals. In this case, therefore, the range of values that can be stored in the salary column is from -999.99 to 999.99. MySQL enforces this limit as of MySQL 5.0.3. Before 5.0.3, on the positive end of the range, the column could actually store numbers up to 9999.99. (For positive numbers, MySQL 5.0.2 and earlier used the byte reserved for the sign to extend the upper end of the range.)

So the issue is the 'weight' column's definition: weight decimal(4,2) default '0.00'. If you change this to weight decimal(5,2) default '0.00' the error will go away. To further explain 4 digits with two decimal places (decimal(4,2)) would allow a value of 100.0 for MySQL 5.0.2 and earlier whereas MySQL 5.0.3 and later stricly enforce a maximum value of 99.99.

regards,
Jeff
Re: Could not get an uncategorized id!

Owwww fantastic. What I will do is reinstall MySQL 5.0.3 and change the weight column which you specified. At least I know next time what to do

Many Thanks to all - I'me sure this will help people who have encountered similar issues.

Regards,

Josh

Re: Could not get an uncategorized id!

Brilliant!  Thanks Jeff.  I was having the same issue, and your suggestion resolved the problem.  Kudos!
Re: Could not get an uncategorized id!

"Brilliant!  Thanks Jeff.  I was having the same issue, and your suggestion resolved the problem.  Kudos!"

HEH! What can I say

Josh