Commit c510cb2e authored by mathieso's avatar mathieso

Test, test, test...

parent cb85b680
......@@ -17,6 +17,11 @@ When submit, can be slow, tell user that something is happening.
Same for showing the exercise in the first place.
# FiB
Give-up option.
# Subm
Show submit new button when should not abe able to.
......
No preview for this file type
......@@ -84,9 +84,9 @@ class ListsController extends ControllerBase {
$view = Views::getView('exercises');
$result['view'] = $this->t('Exercises view embed error.');
if (is_object($view)) {
$display = is_null($this->currentClass->getWrappedDrupalClassNode())
? 'no_current_class' // User has no current class.
: 'with_current_class';
$display = $this->currentClass->isCurrentClass()
? 'with_current_class'
: 'no_current_class'; // User has no current class.
$view->setDisplay($display);
$view->preExecute();
$view->execute();
......
......@@ -127,14 +127,13 @@ class TimelineBlock extends BlockBase implements ContainerFactoryPluginInterface
return AccessResult::forbidden();
}
// Hide block if not a current class.
$canShow = FALSE;
if (!$this->currentClass->isCurrentClass()) {
$canShow = TRUE;
if ($this->currentClass->isCurrentClass()) {
$result = AccessResult::allowed();
}
if ($canShow) {
return AccessResult::allowed();
else {
$result = AccessResult::forbidden();
}
return AccessResult::forbidden();
return $result;
}
/**
......
......@@ -231,6 +231,7 @@ class ExerciseTag extends SkillingCustomTagBase {
$challengeImageUrl = $moduleUrl . 'images/challenge.png';
// Get data from the class about due date, required, etc.
// Only makes sense if there is a current class, and the user is a student.
// Leave vars as null to make template skip showing them at all.
$isRequiredDisplay = null;
$exerciseMaxSubsDisplay = null;
$whenDueDisplay = null;
......@@ -294,8 +295,8 @@ class ExerciseTag extends SkillingCustomTagBase {
'#internal_name' => $exercise->field_internal_name->value,
'#due_date' => $whenDueDisplay,
'#required' => $isRequiredDisplay,
'#max_subs' => (int)$exerciseMaxSubsDisplay,
'#number_subs' => (int)$numberOfSubmissions,
'#max_subs' => $exerciseMaxSubsDisplay,
'#number_subs' => $numberOfSubmissions,
'#challenge' => $challenge,
'#challenge_image_url' => $challengeImageUrl,
'#submission_links' => $renderableSubmissionLinks,
......
......@@ -49,7 +49,7 @@ class ExerciseDueDate extends Drupal\views\Plugin\views\field\Date { //FieldPlu
if ($exercise->bundle() === SkillingConstants::EXERCISE_CONTENT_TYPE) {
/** @var SkillingCurrentClass $currentClass */
$currentClass = Drupal::service('skilling.current_class');
if (!is_null($currentClass->getWrappedDrupalClassNode())) {
if ($currentClass->isCurrentClass()) {
$exerciseDueData
= $currentClass->getExerciseDueRecordForExercise($exercise->id());
if (!is_null($exerciseDueData)) {
......
......@@ -100,7 +100,7 @@ class Timeline {
$exerciseDueRecords = $this->currentClass->getExerciseDueRecords();
$exerciseDuesNids = [];
foreach ($exerciseDueRecords as $exerciseDueRecord) {
$exerciseDuesNids = $exerciseDueRecord->getExerciseId();
$exerciseDuesNids[] = $exerciseDueRecord->getExerciseId();
}
$exerciseRecords = [];
$exerciseNids = [];
......
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