Skip to content

Commit

Permalink
MigrationMoodle: Fix order for lp item views - refs BT#15992
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Feb 27, 2020
1 parent a550361 commit 43834f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugin/migrationmoodle/src/Loader/UserLearnPathsLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public function load(array $incomingData)
$lps = $learnPathsRepo->findBy(['cId' => $course->getId(), 'lpType' => 1]);

foreach ($lps as $lp) {
$lpItems = $lpItemRepo->findBy(['lpId' => $lp->getId()]);

$params = [
'c_id' => $course->getId(),
'lp_id' => $lp->getId(),
Expand All @@ -52,6 +50,11 @@ public function load(array $incomingData)
$lpViewId = \Database::insert($tblLpView, $params);
\Database::query("UPDATE $tblLpView SET id = iid WHERE iid = $lpViewId");

$lpItems = $lpItemRepo->findBy(
['lpId' => $lp->getId()],
['parentItemId' => 'ASC', 'displayOrder' => 'ASC']
);

foreach ($lpItems as $lpItem) {
$params = [
'c_id' => $course->getId(),
Expand Down

0 comments on commit 43834f5

Please sign in to comment.