Duplicated courses fail on opigno_learning_path.modules.get_items

Created on 4 October 2023, about 1 year ago

Problem/Motivation

After a course was duplicated, the activities are un-editable. The course cans be done by users, but the edit-screen is broken, at the "Activities" step. No activity (and no module) are visible there.

Steps to reproduce

Create a course with modules and activities, and duplicate it. Edit the new course and proceed until the "activities" tab: it's empty.

Proposed resolution

I did a bit of investigating and found that for the api request opigno_learning_path.modules.get_items, on this line $group_content = $group->getContent('subgroup:opigno_course'); at the start of the function, the original course returned empty, but the duplicated course had 1 element. This caused the function to go into a loop that hard-failed with the error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: Plugin ID 'opigno_module_group' was not found. in Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin() (line 79 of core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php).

Drupal\Component\Plugin\LazyPluginCollection->get('opigno_module_group') (Line: 18)
Drupal\group\Plugin\GroupContentEnablerCollection->get('opigno_module_group') (Line: 314)
Drupal\group\Entity\GroupType->getContentPlugin('opigno_module_group') (Line: 78)
Drupal\group\Entity\Storage\GroupContentStorage->loadByGroup(Object, 'opigno_module_group', Array) (Line: 145)
Drupal\group\Entity\Group->getContent('opigno_module_group') (Line: 252)
Drupal\opigno_learning_path\Controller\LearningPathContentController->getModules(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I did not go further with debugging yet

Remaining tasks

Finish the debugging, fix the problem.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇭Switzerland mathilde_dumond

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024