moodlehq / moodle-tool_migratehvp2h5p

Tool to migrate mod_hvp to Moodle 3.9 mod_h5pactivity modules
Other
5 stars 10 forks source link

Migration failed (Invalid course module ID) #10

Closed durzo closed 3 years ago

durzo commented 4 years ago

We have a site that is on postgres with a clone of the db on mariadb (converted from mariadb to postgres).

The migration tool runs successfully on mariadb, but on postgres every item fails migration. Adding some debugging here is what I know:

I added an mtrace to line 96 of classes/api.php in function migrate_hvp2h5p:

            mtrace(print_r($h5pactivity, true));
            h5pactivity_update_grades($h5pactivity);

This gives me:

Migrating ID:1  Accordion    course:1180    H5P examples
accordion-1.h5p
stdClass Object
(
    [course] => 1180
    [name] => Accordion
    [timecreated] => 1601551628
    [timemodified] => 1601551628
    [intro] => <p>This resource create vertically stacked expandable items.</p>
<p>Formatting options of the headings is a bit limited. The varying H tags do not actually change the size of the heading as noted in the resource editor.</p>
    [introformat] => 1
    [grade] => 100
    [grademethod] => 1
    [displayoptions] => 0
    [enabletracking] => 1
    [packagefile] => 298233215
    [cm] => stdClass Object
        (
            [course] => 1180
            [module] => 46
            [visible] => 1
            [visibleoncoursepage] => 1
            [section] => 15972
            [score] => 0
            [indent] => 0
            [groupmode] => 0
            [groupingid] => 0
            [completion] => 1
            [completiongradeitemnumber] => 
            [completionview] => 0
            [completionexpected] => 0
            [availability] => 
            [showdescription] => 1
            [added] => 1601551628
            [id] => 145374
            [instance] => 1736
        )

    [coursemodule] => 145374
    [module] => 46
    [modulename] => h5pactivity
    [id] => 1736
    [cmid] => 145374
    [gradeitem] => stdClass Object
        (
            [id] => 62903
            [courseid] => 1180
            [categoryid] => 2022
            [itemname] => Accordion
            [itemtype] => mod
            [itemmodule] => h5pactivity
            [iteminstance] => 1736
            [itemnumber] => 0
            [iteminfo] => 
            [idnumber] => 
            [calculation] => 
            [gradetype] => 1
            [grademax] => 100.00000
            [grademin] => 0.00000
            [scaleid] => 
            [outcomeid] => 
            [gradepass] => 0.00000
            [multfactor] => 1.00000
            [plusfactor] => 0.00000
            [aggregationcoef] => 0.00000
            [aggregationcoef2] => 0.00000
            [sortorder] => 25
            [display] => 0
            [decimals] => 
            [hidden] => 0
            [locked] => 0
            [locktime] => 0
            [needsupdate] => 1
            [weightoverride] => 0
            [timecreated] => 1601551628
            [timemodified] => 1601551628
        )

)

    Exception: Invalid course module ID

     ...Failed!

The function throwing the exception is get_user_grades_for_gradebook in mod/h5pactivity/classes/local/grader.php on line 152:

$manager = manager::create_from_instance($this->instance);

This is about where my knowledge of Moodle stops.. any help appreciated.

sarjona commented 3 years ago

Hi @durzo !

Thanks for reporting this. I've tried to reproduce the issue in my local environment with Postgres and an accordion content type but I haven't been able to get this error... as this is related to the grades, we need more information, such as what's the content in {hvp_xapi_results} table for this content type, in order to figure out what's happening there.

durzo commented 3 years ago

Closing this as we haven't seen it in a while. will re-open if I can reproduce again