The code in assessments.php - $action == 'insertelements' must produce error because the number of descriptions is one less than the number of grades. The error message is
ERROR: null value in column "description" violates not-null constraint
INSERT INTO mdl_workshop_elements ( ID, WORKSHOPID, ELEMENTNO, MAXSCORE ) VALUES ( 136, 38, 3, 5 )
This is caused by the last grade mapping item which should not be considered as a proper element.