Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-41967

grade book download shows error when using custom profile fields.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.4.7, 2.5.3
    • 2.4.6, 2.5
    • Gradebook
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • wip-MDL-41967-master
    • Hide

      Create some custom profile fields

      1. Go to [Administration ► Site administration ► Users ► Accounts ► User profile fields].
      2. Create one or two user profile fields making note of the short name of each field (to be used later).

      Enable profile fields in grade settings

      1. Go to [Administration ► Site administration ► Grades ► General settings].
      2. in 'grade_export_customprofilefields' put in the short names of the custom fields separated by commas.

      Download gradebook (There should be no errors)

      1. Go to a course with some activities that have been graded.
      2. Go to [Administration ► Grade administration ► Export ► Plain text file] and export the gradebook.

      Important

      • This needs to be tested on all databases.
      Show
      Create some custom profile fields Go to [Administration ► Site administration ► Users ► Accounts ► User profile fields] . Create one or two user profile fields making note of the short name of each field (to be used later). Enable profile fields in grade settings Go to [Administration ► Site administration ► Grades ► General settings] . in 'grade_export_customprofilefields' put in the short names of the custom fields separated by commas. Download gradebook (There should be no errors) Go to a course with some activities that have been graded. Go to [Administration ► Grade administration ► Export ► Plain text file] and export the gradebook. Important This needs to be tested on all databases.

      When custom profile fields have been created and then enabled in the gradebook general settings, the download of the gradebook fails with the following problem:

      Debug info: ERROR: syntax error at or near "'customfield_firstdate'"
      LINE 1: SELECT u.*, cf0.data AS 'customfield_firstdate' , u.lastname...
      ^
      SELECT u.*, cf0.data AS 'customfield_firstdate' , u.lastname AS usrt1, u.firstname AS usrt2, u.id AS usrt
      FROM mdl_user u
      JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
      JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = $1)
      WHERE eu1_u.deleted = 0 AND eu1_u.id <> $2 AND eu1_ue.status = $3 AND eu1_e.status = $4 AND eu1_ue.timestart < $5 AND (eu1_ue.timeend = 0 OR eu1_ue.timeend > $6)) je ON je.id = u.id
       
      LEFT JOIN (SELECT * FROM mdl_user_info_data
      WHERE fieldid = $7) cf0
      ON u.id = cf0.userid
      JOIN (
      SELECT DISTINCT ra.userid
      FROM mdl_role_assignments ra
      WHERE ra.roleid = $8
      AND ra.contextid IN ($9,$10,$11)
      ) rainner ON rainner.userid = u.id
      WHERE u.deleted = 0
       
      ORDER BY usrt1 ASC, usrt2 ASC, usrt ASC
      [array (
      0 => '2',
      1 => '1',
      2 => 0,
      3 => 0,
      4 => 1380092900,
      5 => 1380092900,
      6 => '1',
      7 => '5',
      8 => '41',
      9 => '3',
      10 => '1',
      )]
      Error code: dmlreadexception
      Stack trace:
       
          line 436 of /lib/dml/moodle_database.php: dml_read_exception thrown
          line 239 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
          line 702 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
          line 214 of /grade/lib.php: call to pgsql_native_moodle_database->get_recordset_sql()
          line 244 of /grade/export/lib.php: call to graded_users_iterator->init()
          line 62 of /grade/export/txt/index.php: call to grade_export->display_preview()
      

      This isn't a problem when using mysql, but is present in postgres

            abgreeve Adrian Greeve
            abgreeve Adrian Greeve
            Ankit Agarwal Ankit Agarwal
            Damyon Wiese Damyon Wiese
            Jason Fowler Jason Fowler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.