Commit e49ab7f4 authored by mathieso's avatar mathieso

Show unpublished exercises in feedback interface.

parent f2f205e9
......@@ -12477,6 +12477,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//
//
//
//
//
......@@ -13096,21 +13098,25 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
// console.log('createMessage');
let message = '';
const student = window.students[window.submissions[this.submissionId].studentId];
console.log("student", student);
// console.log("student", student);
const isCanSeeNames = student.isCanSeeNames;
console.log("isCanSeeNames", isCanSeeNames);
// console.log("isCanSeeNames", isCanSeeNames);
let greeting = this.getRandom(window.greetings);
console.log("greeting afore sub", greeting);
// console.log("greeting afore sub", greeting);
if (isCanSeeNames) {
greeting = this.replaceStudentNameTokens(greeting, student);
} else {
greeting = this.killStudentNameTokens(greeting);
}
console.log("greeting after sub", greeting);
// console.log("greeting after sub", greeting);
message += greeting + '<br><br>';
let overallEval = window.submissions[this.submissionId].overallEvaluation;
let overallEvalListToUse = window.summaries[overallEval.toLowerCase()];
let overallEvalMessage = this.getRandom(overallEvalListToUse);
if (isCanSeeNames) {
overallEvalMessage = this.replaceStudentNameTokens(overallEvalMessage, student);
} else {
overallEvalMessage = this.killStudentNameTokens(overallEvalMessage);
}
message += overallEvalMessage; // + '<br><br>';
//Chosen rubric responses.
......@@ -13119,6 +13125,11 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
graderChoices.forEach(function (choicesForRubricItem) {
choicesForRubricItem.forEach(function (responseOptionId) {
let responseText = window.responseOptions[responseOptionId].response;
if (isCanSeeNames) {
responseText = this.replaceStudentNameTokens(responseText, student);
} else {
responseText = this.killStudentNameTokens(responseText);
}
message += `<li>${responseText}</li>`;
});
});
......@@ -13128,6 +13139,11 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
ri.newOptions.forEach(newOption => {
if (newOption.chosen) {
let newOptionTitle = newOption.title;
if (isCanSeeNames) {
newOptionTitle = this.replaceStudentNameTokens(newOptionTitle, student);
} else {
newOptionTitle = this.killStudentNameTokens(newOptionTitle);
}
// console.log('',);
if (newOptionTitle.trim() === '') {
newOptionTitle = '(Missing)';
......@@ -13140,6 +13156,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
let signature = this.getRandom(window.signatures);
if (isCanSeeNames) {
signature = this.replaceStudentNameTokens(signature, student);
} else {
signature = this.killStudentNameTokens(signature);
}
message += signature;
window.submissions[this.submissionId].feedback = message;
......@@ -13177,16 +13195,14 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
return result;
},
replaceUnrestrictedTokens(text) {
let studentFirstName = student.firstName;
let classEnrolled = window.classes[student.inClassId];
let graderFirstName = window.grader.firstName;
//Replace tokens.
let result = value.replace('[student_first_name]', studentFirstName);
result = result.replace('[grader first name]', graderFirstName);
killStudentNameTokens(text) {
let result = text.replace('[student_first_name]', '');
result = result.replace('[student_last_name]', '');
return result;
},
replaceUnrestrictedTokens(text) {},
/**
* Grader clicked Send message button. Tell the parent about it.
*/
......@@ -29688,7 +29704,12 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
class: {
'js-collapse-panel-body': !_vm.submissionGraded
}
}, [_vm._v("\n " + _vm._s(_vm.rubricItem.title) + "\n "), _c('div', {
}, [_vm._v("\n " + _vm._s(_vm.rubricItem.title) + "\n "), _c('span', {
staticClass: "glyphicon glyphicon-trash",
attrs: {
"aria-hidden": "true"
}
}), _vm._v(" "), _c('div', {
staticClass: "pull-right"
}, [_c('button', {
ref: "collapseButton",
......@@ -29707,7 +29728,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"innerHTML": _vm._s(_vm.summarizeOptionsChosen())
}
})]), _vm._v(" "), _c('div', {
staticClass: "panel-body collapse"
staticClass: "panel-body"
}, [_vm._l((_vm.rubricItem.responseOptionIds), function(responseOptionId) {
return _c('rubric-item-response-option', {
key: "responseOptionId",
......
This diff is collapsed.
......@@ -7,6 +7,7 @@
:class="{'js-collapse-panel-body':!submissionGraded}"
>
{{ rubricItem.title }}
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
<div class="pull-right">
<!--Button to collapse/expand rubric item option deets.
Used Bootstrap animations rather than Vue transitions, because I like the effect.
......@@ -24,7 +25,8 @@
>
</div>
</div>
<div class="panel-body collapse">
<div class="panel-body">
<!-- <div class="panel-body collapse">-->
<rubric-item-response-option
v-for="responseOptionId in rubricItem.responseOptionIds"
key="responseOptionId"
......
......@@ -41,8 +41,6 @@ Check progress score computation, and reports for instructor.
Submissions view for graders, own submissions only.
Show all rubric item responses initially.
Toggle of keep-this-response unclear, when id on or off.
- doesn't work? Stops working?
......@@ -51,10 +49,6 @@ Refresh after a while crashes.
Show RIs where uncollapsey items not changed.
Also when nothing selected, on the RI header itself.
Show student about, and instructor emails
**2.0** Show prior submissions.
**2.0** Maintain order of RIs in text message
......@@ -298,8 +292,6 @@ X Limits for individual exercises. Esp for exams.
# Grading interface
Show all rubric item responses initially.
Toggle of keep-this-response unclear, when id on or off.
- doesn't work? Stops working?
......@@ -308,13 +300,6 @@ Refresh after a while crashes.
Show RIs where uncollapsey items not changed.
Also when nothing selected, on the RI header itself.
**2.0** Show submissions to unpublished exercises, with marker showing
that exer is unpublished. U before exer name?
Show student about, and instructor emails
**2.0** Show prior submissions.
**2.0** Maintain order of RIs in text message
......
......@@ -179,7 +179,6 @@ class Assessment {
/**
* Get ungraded submissions for a set of classes.
*
* Never count unpublished classes.
* Never count submissions from
* blocked users. Never count unpublished submissions.
* Never count unpublished enrollments.
......@@ -188,13 +187,18 @@ class Assessment {
* @param array $classIds
* Nids of classes to check.
*
* @param bool $includeUnpublishedExercises
* Whether to include unpublished exercises.
*
* @return array
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* @throws \Exception
*/
public function getUngradedSubmissionsForClasses(array $classIds) {
public function getUngradedSubmissionsForClasses(
array $classIds,
$includeUnpublishedExercises = TRUE
) {
// Load classes that are published.
$classes = [];
foreach ($classIds as $classId) {
......@@ -247,17 +251,19 @@ class Assessment {
}
// Query to grab ids of published submissions from those students
// that have not been graded.
$submissionIds = $this->entityTypeManager->getStorage('node')
$query = $this->entityTypeManager->getStorage('node')
->getQuery()
->condition('type', SkillingConstants::EXERCISE_SUBMISSION_CONTENT_TYPE)
// Published submissions.
->condition('status', 1)
->condition('field_user', $studentIds, 'IN')
// Published exercises only.
->condition('field_exercise.entity.status', 1)
// No feedback given.
->notExists('field_when_feedback_given')
->execute();
->notExists('field_when_feedback_given');
if (!$includeUnpublishedExercises) {
// Published exercises only.
$query->condition('field_exercise.entity.status', 1);
}
$submissionIds = $query->execute();
// Leave if there are none.
if (count($submissionIds) === 0) {
return [];
......
......@@ -830,17 +830,16 @@ class AssessmentController extends ControllerBase {
foreach ($exercise->field_rubric_items as $rubricItem) {
$rubricItemIds[] = $rubricItem->target_id;
}
// Try parsing the exercise body to show the grader. If it doesn't work,
// show the unparsed body.
// try {
// $bodyToShow = $this->skillingParser->parse($exercise->body->value);
// } catch (\Exception $e) {
$bodyToShow = $exercise->body->value;
// }
$bodyToShow = $exercise->body->value;
$titleToShow = $this->filterInputService->filterUserContent($exercise->title->value);
if (!$exercise->isPublished()) {
$titleToShow .= (string)($this->t(" (U)"));
}
/* @noinspection PhpUndefinedFieldInspection */
$result[$exercise->id()] = [
'exerciseId' => $exercise->id(),
'title' => $this->filterInputService->filterUserContent($exercise->title->value),
'published' => $exercise->isPublished(),
'title' => $titleToShow,
'description' => $this->filterInputService->filterUserContent($bodyToShow),
// 'description' => $this->filterInputService->filterUserContent($exercise->body->value),
'notes' => $this->filterInputService->filterUserContent($exercise->field_notes->value),
......
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