Commit 021f56ca authored by mathieso's avatar mathieso

Fix bug in Your class page.

parent ab8cfc22
......@@ -84,10 +84,6 @@ Save and edit fior exercises
? Skip submissions for exercises/students that don't exist anymore. Or student blocked.
Authors use skilling input filter.
Everyone elses uses stripped, or plain.
......
......@@ -203,7 +203,7 @@ class AdminController extends ControllerBase {
* ARGH! This method cannot call another method to do its work.
*
* function calledByRoute() {
* $this->>bee();
* $this->bee();
* }
* function bee() {
* make batch job
......
......@@ -201,20 +201,19 @@ class YourClassController extends ControllerBase {
}
$picture = '';
// Is there a picture?
if (!$instructor->user_picture->isEmpty()) {
if ($instructor->getPictureUrl()) {
// Yes. Show it at the original upload size.
$picture = $instructor->user_picture->entity->getFileUri();
$picture = file_create_url($picture);
$picture = $instructor->getPictureUrl();
}
$instructorRenderable = [
'first_name' => $this->filterInputService->filterUserContent(
$instructor->get(SkillingConstants::FIELD_FIRST_NAME)->value
$instructor->getFirstName()
),
'last_name' => $this->filterInputService->filterUserContent(
$instructor->get(SkillingConstants::FIELD_LAST_NAME)->value
$instructor->getLastName()
),
'about' => $this->filterInputService->filterUserContent(
$instructor->get(SkillingConstants::FIELD_ABOUT)->value
$instructor->getAbout()
),
'picture' => $picture,
'uid' => $instructor->id(),
......
......@@ -4,14 +4,17 @@ namespace Drupal\skilling\MakeStarterContent;
use DateInterval;
use DateTime;
use Drupal\Core\Batch\BatchBuilder;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
use Drupal\skilling\SkillingConstants;
use Drupal\skilling\BookUpdateTracker;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Create starter content.
......@@ -149,6 +152,52 @@ class MakeStarterContent {
$this->entityTypeManager = $entityTypeManager;
}
/**
* Trigger a batch job that recomputes all completion scores.
*
* Scores for all classes. Redirect to submissions admin menu.
*
* ARGH! This method cannot call another method to do its work.
*
* function calledByRoute() {
* $this->bee();
* }
* function bee() {
* make batch job
*
* This FAILS!
*
* Must be:
*
* function calledByRoute() {
* make batch job
*
* And don't forget:
*
* use DependencySerializationTrait;
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
// public function createStarterContent($password = '') {
// $returnUrl = Url::fromRoute('skilling.admin.config.starter_content');
// // Make a BatchBuilder.
// $batchBuilder = (new BatchBuilder())
// ->setTitle($this->t('Make starter content'))
// ->setErrorMessage($this->t('Problem making starter content.'))
// ->setFinishCallback([$this, 'doneMakingStarterContent']);
// // Add operations.
// $this->adminUser = $this->makeUsersService->loadAdminUser();
// $batchBuilder->addOperation([$this, 'makeUsers'], [$password]);
// $batchBuilder->addOperation([$this, 'makeClasses']);
// $batchBuilder->addOperation([$this, 'enrollUsersInClasses']);
// // Start the batch job.
// batch_set($batchBuilder->toArray());
// return batch_process($returnUrl);
// }
/**
* Create starter content.
*
......
......@@ -153,7 +153,7 @@ class SkillingClass {
->loadMultiple($instructorIds);
$result = [];
foreach ($instructors as $instructor) {
$result = $this->skillingUserFactory->makeSkillingUser($instructor);
$result[] = $this->skillingUserFactory->makeSkillingUser($instructor);
}
return $result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment