Merge pull request #5013 from christianbeeznest/ofaj-21219

Course: Fix error loading home page - refs BT#21219
pull/5014/head
christianbeeznest 12 months ago committed by GitHub
commit 563a0d1e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 54
      src/CoreBundle/Controller/CourseController.php
  2. 3
      src/CoreBundle/EventSubscriber/AnonymousUserSubscriber.php

@ -245,52 +245,6 @@ class CourseController extends ToolBaseController
];
}
// Get session-career diagram
$diagram = '';
/*$allow = api_get_configuration_value('allow_career_diagram');
if (true === $allow) {
$htmlHeadXtra[] = api_get_js('jsplumb2.js');
$extra = new ExtraFieldValue('session');
$value = $extra->get_values_by_handler_and_field_variable(
api_get_session_id(),
'external_career_id'
);
if (!empty($value) && isset($value['value'])) {
$careerId = $value['value'];
$extraFieldValue = new ExtraFieldValue('career');
$item = $extraFieldValue->get_item_id_from_field_variable_and_field_value(
'external_career_id',
$careerId,
false,
false,
false
);
if (!empty($item) && isset($item['item_id'])) {
$careerId = $item['item_id'];
$career = new Career();
$careerInfo = $career->get($careerId);
if (!empty($careerInfo)) {
$extraFieldValue = new ExtraFieldValue('career');
$item = $extraFieldValue->get_values_by_handler_and_field_variable(
$careerId,
'career_diagram',
false,
false,
0
);
if (!empty($item) && isset($item['value']) && !empty($item['value'])) {
// @var Graph $graph
$graph = UnserializeApi::unserialize('career', $item['value']);
$diagram = Career::renderDiagram($careerInfo, $graph);
}
}
}
}
}*/
// Deleting the objects
$session->remove('toolgroup');
$session->remove('_gid');
@ -306,10 +260,14 @@ class CourseController extends ToolBaseController
$shortcuts = $shortcutQuery->getQuery()->getResult();
}
$responseData = [
'course' => $course,
'course' => [
'id' => $course->getId(),
'title' => $course->getTitle(),
'resourceNode' => $course->getResourceNode(),
],
'session' => $courseSession,
'shortcuts' => $shortcuts,
'diagram' => $diagram,
'diagram' => '',
'tools' => $tools,
];

@ -113,7 +113,6 @@ class AnonymousUserSubscriber implements EventSubscriberInterface
foreach ($anonymousUsers as $user) {
$loginRecord = $trackLoginRepository->findOneBy(['userIp' => $userIp, 'user' => $user]);
if ($loginRecord) {
error_log('Existing login found for user ID: '.$user->getId());
return $user->getId();
}
@ -147,8 +146,6 @@ class AnonymousUserSubscriber implements EventSubscriberInterface
$this->entityManager->persist($anonymousUser);
$this->entityManager->flush();
error_log('New anonymous user created: '.$anonymousUser->getId());
return $anonymousUser->getId();
}
}

Loading…
Cancel
Save