Commit bb1bdbf4 authored by mathieso's avatar mathieso

Fixin' them bugs, pardner.

parent e5f6bb75
......@@ -7,3 +7,8 @@
margin-top: -0.8rem;
margin-bottom: 0.2rem;
}
.skilling-insert-exercise-attribs span {
display: inline-block;
width: 12rem;
}
......@@ -69,6 +69,9 @@ table.skilling-timeline-table.table td {
}
.skilling-exercise-not-complete {
}
.skilling-exercise-no-more-subs {
text-decoration: line-through;
}
......
......@@ -147,7 +147,8 @@
case EXERCISE_SUBMISSION_MAX_SUBMISSIONS_REACHED:
title = "No more submissions allowed";
elementClass = "skilling-exercise-no-more-subs";
marker = "";
marker = "🚫";
break;
default:
title = "";
elementClass = "";
......
......@@ -20,10 +20,6 @@ Max days after no submission possible.
# Starter content
- can't create paragraphs when adding exercises due to class.
- class - start date MT
......@@ -49,7 +45,7 @@ After install, config form shows initials not required. Student submission asks
Save config form, and it works, when checkbox is clear. Need to explicitly set
the value of the flag during install?
- changed code, did it work? NO
?- changed code, did it work?
- check other config flag init code. Some things missing?
......
No preview for this file type
......@@ -33,11 +33,12 @@ function skilling_install() {
->getEditable(SkillingConstants::SETTINGS_MAIN_KEY)
->set(SkillingConstants::SETTING_KEY_SUBMISSION_TEXT_WIDGET, 1)
->set(SkillingConstants::SETTING_KEY_SUBMISSION_UPLOAD_WIDGET, 1)
->set(SkillingConstants::SETTING_KEY_SUBMISSIONS_POLICIES, 0)
->set(SkillingConstants::SETTING_KEY_SUBMISSION_REQUIRE_INITIALS, 0)
->set(SkillingConstants::SETTING_KEY_SUBMISSIONS_POLICIES,
t("<p>Each of your exercise submissions must comply with course policies. When you submit an exercise, you verify that it complies with those policies.</p>
<p>If you don't know what the policies are, ask your instructor.</p>")
t("<p>Your exercise submissions must comply with course policies.
If you don't know what the policies are, ask your instructor.</p>")
)
->set(SkillingConstants::SETTING_KEY_GRADERS_SEE_STUDENT_NAMES, 0)
->save();
// Set IMCE profiles used by authors.
\Drupal::configFactory()
......
......@@ -402,7 +402,7 @@ skilling.admin.enrollments.add_enrollment:
# Skilling | Exercises and rubric items
skilling.admin.exercises:
title: 'Exercises and rubrics items'
title: 'Exercises and rubric items'
route_name: skilling.admin.exercises
parent: system.admin.skilling
description: 'Manage exercises and rubric items.'
......
......@@ -1642,31 +1642,6 @@ function skilling_node_view_alter(array &$build, Drupal\Core\Entity\EntityInterf
],
]
];
// /** @var \Drupal\skilling\Submissions $submissionsService */
// $submissionsService = Drupal::service('skilling.submissions');
// $renderableSubmissionLinks = $submissionsService->createSubmissionLinks($node);
// $showExerciseLink = $currentUser->isAdministrator()
// || $currentUser->isAuthor()
// || $currentUser->isReviewer()
// || $currentUser->isInstructor()
// || $currentUser->isGrader();
// $build['submission_status'] = [
// '#theme' => 'exercise_submission_links',
// '#exercise_nid' => $node->id(),
// '#internal_name' => $node->field_internal_name->value,
// '#submission_links' => $renderableSubmissionLinks,
// '#show_exercise_link' => $showExerciseLink ? 'yes' : 'no',
// '#weight' => 10,
// // '#cache' => [
// // 'max-age' => 0,
// // ],
// '#attached' => [
// 'library' => 'skilling/exercise-links',
// 'drupalSettings' => [
// 'skillingFloatQueryParam' => SkillingConstants::FLOATER_QUERY_STRING,
// ],
// ],
// ];
if ($currentUser->isAdministrator() || $currentUser->isAuthor()) {
// Add a link to add a new exercise.
$addExerciseLink = [
......
......@@ -85,6 +85,13 @@ function skilling_views_data_alter(&$data) {
'id' => 'standard',
],
];
$data['student_submissions']['exercise_due_date'] = [
'title' => t('Exercise due date'),
'help' => t('Exercise due date.'),
'field' => [
'id' => 'date',
],
];
$data['student_submissions']['where_referenced'] = [
'title' => t('Where referenced'),
'help' => t('Lessons that include the exercise.'),
......
......@@ -63,7 +63,7 @@ class SubmissionsConfigurationForm extends ConfigFormBase {
];
$form['require_initials'] = [
'#type' => 'checkbox',
'#title' => $this->t('Student intials required for submission'),
'#title' => $this->t('Student initials required for submission'),
'#description' => $this->t(
"Students are required to enter their initials, before they
can submit a solution."
......
......@@ -273,7 +273,7 @@ class ExerciseTag extends SkillingCustomTagBase {
: (string) $this->t('No');
// Compute when due.
$classStartDate = new DateTime($this->currentClass->getStartDate());
$dueDaysInterval = new DateInterval('P' . $exerciseDue['day'] . 'D');
$dueDaysInterval = new DateInterval('P' . ($exerciseDue['day'] - 1) . 'D');
$exerciseDueDate = clone $classStartDate;
$exerciseDueDate->add($dueDaysInterval);
$whenDueDisplay = $this->skillingUtilities->daysDiffNowString($exerciseDueDate);
......
......@@ -2,6 +2,8 @@
namespace Drupal\skilling\Plugin\views\query;
use DateInterval;
use DateTime;
use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\skilling\CurrentClass;
......@@ -260,11 +262,6 @@ class StudentSubmissionsDataSource extends QueryPluginBase {
break;
}
}
if (is_null($exerciseDue)) {
throw new SkillingException(
Html::escape('Exer id not found: ' . $exercise->id()), __FILE__, __LINE__
);
}
$submissionStatus = $this->submissionsService
->getSubmissionStatusForStudentExercise(
$this->skillingCurrentUser,
......@@ -291,6 +288,17 @@ class StudentSubmissionsDataSource extends QueryPluginBase {
$row['exercise_title'] = $exercise->getTitle();
$row['exercise_internal_name'] = $exercise->field_internal_name->value;
$row['exercise_max_subs'] = $exerciseMaxSubsDisplay;
// Compute when due date.
if (is_null($exerciseDue)) {
$row['exercise_due_date'] = null;
}
else {
$classStartDate = new DateTime($this->currentClass->getStartDate());
$dueDaysInterval = new DateInterval('P' . ($exerciseDue['day'] - 1) . 'D');
$exerciseDueDate = clone $classStartDate;
$exerciseDueDate->add($dueDaysInterval);
$row['exercise_due_date'] = $exerciseDueDate->getTimestamp();
}
$row['where_referenced'] = [];
// Get array of lesson ids that reference the exercise.
$whereReferencedValues = $exercise->field_where_referenced->getValue();
......
......@@ -610,8 +610,26 @@ class Submissions {
. SkillingConstants::PATH_TO_COMPLETE_BADGE;
$submissionSummaries['highest_version_submitted'] = $highestVersion;
$submissionSummaries['waiting_for_feedback'] = $waitingForFeedback;
$submissionSummaries['submissions'] = [];
// Get the student's status for the exercise.
// Get exercise dues for the current class.
list($classExerciseDues, $classExerciseNids)
= $this->currentClass->getExerciseDues();
// Find the exercise due data for the exercise.
$exerciseDue = NULL;
foreach ($classExerciseDues as $record) {
if ($record['exerciseId'] == $exercise->id()) {
$exerciseDue = $record;
break;
}
}
$submissionStatus = $this->getSubmissionStatusForStudentExercise(
$this->currentUser,
(int)$exercise->id(),
$exerciseDue
);
$submissionSummaries['submission_status'] = $submissionStatus;
// Create submission data for each submission.
$submissionSummaries['submissions'] = [];
/* @var Node $submission */
foreach ($submissions as $submission) {
// Data for one submission.
......
......@@ -2,7 +2,6 @@
{% if counts.problem_message %}
<p>{{ counts.problem_message }}</p>
{% else %}
<p>{{ "Here are counts of exercises. The first column says how many exercises of each type are in the course. The second column says how many of each type you have completed."|t }}</p>
<table class="skilling-exercise-counts">
<thead style="table">
<tr>
......@@ -47,10 +46,18 @@
</tr>
</tbody>
</table>
<p>Here's what the different counts are:</p>
<ul>
<li>{{ "Required: You should do all of the required exercises. They're non-challenge exercises that are on the timeline."|t }}</li>
<li>{{ "Optional: They don't count for any points, but help you practice. They're non-challenge exercises that are not on the timeline."|t }}</li>
<li>{{ "Challenge: Challenge exercises help you earn badges, and possibly extra credit (check with your instructor). They may be on the timeline, but don't have to be."|t }}</li>
</ul>
<p>
<a class="small" data-toggle="collapse" href="#counts-explained" aria-expanded="false" aria-controls="counts-explained">
{{ "Help"|t }}
</a>
</p>
<div class="collapse" id="counts-explained">
<p>{{ "The first column says how many exercises of each type are in the course. The second column says how many of each type you have completed."|t }}</p>
<p>{{ "Here's what the different counts are:"|t }}</p>
<ul>
<li>{{ "Required: You should do all of the required exercises. They're non-challenge exercises that are on the timeline."|t }}</li>
<li>{{ "Optional: They don't count for any points, but help you practice. They're non-challenge exercises that are not on the timeline."|t }}</li>
<li>{{ "Challenge: Challenge exercises help you earn badges, if there are any for your course. They may be on the timeline, but don't have to be."|t }}</li>
</ul>
</div>
{% endif %}
......@@ -122,7 +122,7 @@
{% endfor %} {# End looping over submissions. #}
{# Show create new submission link if not complete. #}
{% if not submission_links.complete == 'true' and not submission_links.waiting_for_feedback == 'true' %}
{% if number_subs >= max_subs %}
{% if submission_status == 'max reached' %}
<p class="skilling-max-submissions-reached">
{{ 'You have reached the maximum number of submissions for this exercise.'|t }}
</p>
......
......@@ -3,14 +3,6 @@
{# Template used when inserting exercise by parser, or when showing exercise stand-alone. #}
{# The var out_of_plugin_context identifies the latter. #}
{{ attach_library('skilling/insert-exercise-styling') }}
<h4>Thing: {{ out_of_plugin_context }}</h4>
{% if not out_of_plugin_context %}
<h3>using not</h3>
{% endif %}
{% if out_of_plugin_context %}
<h3>using nothing</h3>
{% endif %}
<div class="skilling-insert-exercise" id="{{ internal_name }}">
{% if not out_of_plugin_context %}
......@@ -42,18 +34,18 @@
{% endif %}
</span>
{% endif %}
{% if required is not null %}
{% if max_subs is not null %}
<span
class="skilling-required"
title="{{ 'Is this exercise required?'|t }}"
>{{ 'Required:'|t }} {{ required }}</span>
class="skilling-max-subs"
title="{{ 'Number of tries you have to complete this exercise.'|t }}"
>{{ 'Submissions limit:'|t }} {{ max_subs }}</span>
{% endif %}
<br>
{% if max_subs is not null %}
{% if required is not null %}
<span
class="skilling-max-subs"
title="{{ 'Number of tries you have to complete this exercise.'|t }}"
>{{ 'Submissions limit:'|t }} {{ max_subs }}</span>
class="skilling-required"
title="{{ 'Is this exercise required?'|t }}"
>{{ 'Required:'|t }} {{ required }}</span>
{% endif %}
{% if number_subs is not null %}
<span
......
{% if links|length == 1 %}
<p>{{ 'In lesson'|t }} {{ links[0] }}</p>
{% else %}
{% elseif links|length > 1 %}
<p>{{ 'In lessons:'|t }}</p>
<ul>
{% for link in links %}
......
......@@ -24,19 +24,27 @@
"<em>Change recorded. Use the recompute link above to see the effect
immediately.</em>"|t
}}</p>
<p>{{
'<em>(Recommended)</em> Leave it unchecked if you want to learn skills well.
Your emoticon will depend on your progress on both required and
optional exercises on the timeline. Challenge exercises won\'t
be included, though.'|t
}}</p>
<p class="skilling-no-bottom-margin">{{
'<em>(Not recommended)</em> Check it if you just care about meeting basic
course requirements,
rather than learning skills well. The progress emoticon will be based
only on required exercises on the timeline. Your progress on optional
and challenge exercises
won\'t affect the emoticon.'|t
<p>
{{ "Recommend: leave unchecked."|t }}
<a class="small" data-toggle="collapse" href="#base-on-required" aria-expanded="false" aria-controls="base-on-required">
{{ "What is this?"|t }}
</a>
</p>
<div class="collapse" id="base-on-required">
<p>{{
'<em>(Recommended)</em> Leave it unchecked if you want to learn skills well.
Your emoticon will depend on your progress on both required and
optional exercises on the timeline. Challenge exercises won\'t
be included, though.'|t
}}</p>
<p class="skilling-no-bottom-margin">{{
'<em>(Not recommended)</em> Check it if you just care about meeting basic
course requirements,
rather than learning skills well. The progress emoticon will be based
only on required exercises on the timeline. Your progress on optional
and challenge exercises
won\'t affect the emoticon.'|t
}}</p>
</div>
</div>
</div>
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