Error importing Leap2A w/ peer assessment

Bug #1803101 reported by Kristina Hoeppner on 2018-11-13
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Status tracked in 19.10
18.10
High
Unassigned
19.04
High
Unassigned
19.10
High
Unassigned

Bug Description

I exported a simple portfolio page as Leap2A and got the error messages below when importing it via the admin interface. The Leap2A file is attached.

[WAR] 37 (lib/adodb/adodb-exceptions.inc.php:45) Array to string conversion
Call stack (most recent first):

    log_message("Array to string conversion", 8, true, true, "/home/kristina/code/mahara/htdocs/lib/adodb/adodb-...", 45) at /home/kristina/code/mahara/htdocs/lib/errors.php:520
    error(8, "Array to string conversion", "/home/kristina/code/mahara/htdocs/lib/adodb/adodb-...", 45, array(size 7)) at /home/kristina/code/mahara/htdocs/lib/adodb/adodb-exceptions.inc.php:45
    ADODB_Exception->__construct("postgres8", "adodb_throw", -1, "ERROR: null value in column "block" violates not-...", "INSERT INTO "artefact_peer_assessment" ("assessmen...", array(size 3), object(ADODB_postgres8)) at /home/kristina/code/mahara/htdocs/lib/adodb/adodb-exceptions.inc.php:80
    adodb_throw("postgres8", "adodb_throw", -1, "ERROR: null value in column "block" violates not-...", "INSERT INTO "artefact_peer_assessment" ("assessmen...", array(size 3), object(ADODB_postgres8)) at /home/kristina/code/mahara/htdocs/lib/adodb/adodb.inc.php:313
    ADODB_TransMonitor("postgres8", "adodb_throw", -1, "ERROR: null value in column "block" violates not-...", "INSERT INTO "artefact_peer_assessment" ("assessmen...", array(size 3), object(ADODB_postgres8)) at /home/kristina/code/mahara/htdocs/lib/adodb/adodb.inc.php:1263
    ADOConnection->_Execute("INSERT INTO "artefact_peer_assessment" ("assessmen...", array(size 3)) at /home/kristina/code/mahara/htdocs/lib/adodb/adodb.inc.php:1223
    ADOConnection->Execute("INSERT INTO "artefact_peer_assessment" ("assessmen...", array(size 3)) at /home/kristina/code/mahara/htdocs/lib/dml.php:1102
    insert_record("artefact_peer_assessment", object(stdClass)) at /home/kristina/code/mahara/htdocs/artefact/peerassessment/lib.php:240
    ArtefactTypePeerassessment->commit() at /home/kristina/code/mahara/htdocs/artefact/peerassessment/import/leap/lib.php:180
    LeapImportPeerassessment::import_using_strategy(object(SimpleXMLElement), object(PluginImportLeap), 1, array(size 0)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:1813
    call_static_method("LeapImportPeerassessment", "import_using_strategy", object(SimpleXMLElement), object(PluginImportLeap), 1, array(size 0)) at /home/kristina/code/mahara/htdocs/import/leap/lib.php:665
    PluginImportLeap->import_from_load_mapping() at /home/kristina/code/mahara/htdocs/import/leap/lib.php:188
    PluginImportLeap->process() at /home/kristina/code/mahara/htdocs/admin/users/add.php:348
    adduser_submit(object(Pieform), array(size 24)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:164
    Pieform::process(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:5258
    pieform(array(size 8)) at /home/kristina/code/mahara/htdocs/admin/users/add.php:156

[WAR] 37 (lib/errors.php:858) Failed to get a recordset: postgres8 error: [-1: ERROR: null value in column "block" violates not-null constraint
DETAIL: Failing row contains (22, null, null, 11, 0).] in adodb_throw(INSERT INTO "artefact_peer_assessment" ("assessment", "view", "private") VALUES (?, ?, ?), Array)Command was: INSERT INTO "artefact_peer_assessment" ("assessment", "view", "private") VALUES (?, ?, ?) and values was (assessment:22,view:11,private:0)
Call stack (most recent first):

    log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /home/kristina/code/mahara/htdocs/lib/errors.php:95
    log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/mahara/htdocs/lib/errors.php:858
    SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/mahara/htdocs/lib/dml.php:1105
    insert_record("artefact_peer_assessment", object(stdClass)) at /home/kristina/code/mahara/htdocs/artefact/peerassessment/lib.php:240
    ArtefactTypePeerassessment->commit() at /home/kristina/code/mahara/htdocs/artefact/peerassessment/import/leap/lib.php:180
    LeapImportPeerassessment::import_using_strategy(object(SimpleXMLElement), object(PluginImportLeap), 1, array(size 0)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:1813
    call_static_method("LeapImportPeerassessment", "import_using_strategy", object(SimpleXMLElement), object(PluginImportLeap), 1, array(size 0)) at /home/kristina/code/mahara/htdocs/import/leap/lib.php:665
    PluginImportLeap->import_from_load_mapping() at /home/kristina/code/mahara/htdocs/import/leap/lib.php:188
    PluginImportLeap->process() at /home/kristina/code/mahara/htdocs/admin/users/add.php:348
    adduser_submit(object(Pieform), array(size 24)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:164
    Pieform::process(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:5258
    pieform(array(size 8)) at /home/kristina/code/mahara/htdocs/admin/users/add.php:156

[WAR] 37 (lib/dml.php:1105) Failed to get a recordset: postgres8 error: [-1: ERROR: null value in column "block" violates not-null constraint
DETAIL: Failing row contains (22, null, null, 11, 0).] in adodb_throw(INSERT INTO "artefact_peer_assessment" ("assessment", "view", "private") VALUES (?, ?, ?), Array)Command was: INSERT INTO "artefact_peer_assessment" ("assessment", "view", "private") VALUES (?, ?, ?) and values was (assessment:22,view:11,private:0)
Call stack (most recent first):

    insert_record("artefact_peer_assessment", object(stdClass)) at /home/kristina/code/mahara/htdocs/artefact/peerassessment/lib.php:240
    ArtefactTypePeerassessment->commit() at /home/kristina/code/mahara/htdocs/artefact/peerassessment/import/leap/lib.php:180
    LeapImportPeerassessment::import_using_strategy(object(SimpleXMLElement), object(PluginImportLeap), 1, array(size 0)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:1813
    call_static_method("LeapImportPeerassessment", "import_using_strategy", object(SimpleXMLElement), object(PluginImportLeap), 1, array(size 0)) at /home/kristina/code/mahara/htdocs/import/leap/lib.php:665
    PluginImportLeap->import_from_load_mapping() at /home/kristina/code/mahara/htdocs/import/leap/lib.php:188
    PluginImportLeap->process() at /home/kristina/code/mahara/htdocs/admin/users/add.php:348
    adduser_submit(object(Pieform), array(size 24)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:164
    Pieform::process(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:5258
    pieform(array(size 8)) at /home/kristina/code/mahara/htdocs/admin/users/add.php:156

I followed the steps and couldn't replicate.

Kevin Dibble (digitalskill) wrote :

Hi Team,

This issue seems to be around line 263
in the file: mahara/htdocs/artefact/peerassessment/lib.php

There are FK_constraints on the table that require block and usr to be present.
however, in the file from Kristina Heoppner, block and usr is NULL when processing:
insert_record('artefact_peer_assessment', $data);

To test, do a 'var_dump($data); die();' above the insert_record line.

This seems to point to two possibilities:
Either the Export is missing block and user data (Export could be the issue)
OR
The import of peer-assessed items is out of order (Creating assessment before creating the block...)

Still looking into it, but this has been what I have found so far.

Kevin Dibble (digitalskill) wrote :

Hi Team,

Attached is a patch - but it will need to be checked by the Mahara team to make sure that using $this->id and $this->get('owner') are valid options should the block id and user id not be present when creatign the assessment block.

Issue:
The Table 'artefact_peer_assessment' has Foreign keys for assessment, block, usr, view, that cannot be empty.

artefact/peerassessment/lib.php line 254 creates the data object - but 'block' and 'usr' are null - db insert fails.

Changing this $data object to fill in these fields with its ID and Owner value succeeds:
 $data = (object)array(
            'assessment' => $this->get('id'),
            'block' => $this->get('block') ? $this->get('block') : $this->id ,
            'usr' => $this->get('usr') ? $this->get('usr') : $this->get('owner'),
            'view' => $this->get('view'),
            'private' => ($this->get('private') ? 1 : 0),
        );

Issue 2: Affects mysql 8:
Line 1252 in File htdocs/import/leap/lib.php uses the word "row" without backticks. As this is a reserved word - there is a second data point of failure here when doing imports.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers