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

calculated question units error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.1.1
    • Questions
    • None
    • MOODLE_401_STABLE

      Hi,

      In a calculated question type I need to manage units like these:

      Unit: W    Multiplier: 1

      Unit: kW    Multiplier: 0.001

      Unit: MW    Multiplier: 1.0E-6

      Unit: mW    Multiplier: 1000

      but I get this error:

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

      Informazioni di debug:  Duplicate entry '1491-mW' for key 'mdl_question_numerical_units.mdl_quesnumeunit_queuni_uix'
      INSERT INTO mdl_question_numerical_units (question,multiplier,unit) VALUES(?,?,?)
      [array (
      0 => 1491,
      1 => 1000,
      2 => 'mW',
      )]
      Error code: dmlwriteexception

      Stack trace: 

      line 497 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
      line 1362 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
      line 1408 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 356 of /question/type/numerical/questiontype.php: call to mysqli_native_moodle_database->insert_record()
      line 63 of /question/type/calculatedsimple/questiontype.php: call to qtype_numerical->save_units()
      line 538 of /question/type/questiontypebase.php: call to qtype_calculatedsimple->save_question_options()
      line 616 of /question/type/calculated/questiontype.php: call to question_type->save_question()
      line 294 of /question/bank/editquestion/question.php: call to qtype_calculated->save_question()

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

      If I exclude the last unit

      Unit: mW    Multiplier: 1000

      it works just fine.

      Regards

      Francesco

        1. um_1.png
          um_1.png
          370 kB
        2. um.png
          um.png
          195 kB

            timhunt Tim Hunt
            Francesco Poletti Francesco Poletti
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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