Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions htdocs/js/MathJaxConfig/mathjax-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ if (!window.MathJax) {
loaderOverlay.classList.add('problem-content');
const bodyRectangle = problemContent.getBoundingClientRect();
loaderOverlay.style.position = 'absolute';
loaderOverlay.style.top = `${bodyRectangle.y}px`;
loaderOverlay.style.left = `${bodyRectangle.x}px`;
loaderOverlay.style.top = `${bodyRectangle.top + window.scrollY}px`;
loaderOverlay.style.left = `${bodyRectangle.left + window.scrollX}px`;
loaderOverlay.style.width = `${bodyRectangle.width}px`;
loaderOverlay.style.height = `${bodyRectangle.height}px`;
loaderOverlay.style.overflow = 'clip';
Expand All @@ -177,8 +177,8 @@ if (!window.MathJax) {
problemContent.after(loaderOverlay);
const resizeObserver = new ResizeObserver(() => {
const bodyRectangle = problemContent.getBoundingClientRect();
loaderOverlay.style.top = `${bodyRectangle.top}px`;
loaderOverlay.style.left = `${bodyRectangle.left}px`;
loaderOverlay.style.top = `${bodyRectangle.top + window.scrollY}px`;
loaderOverlay.style.left = `${bodyRectangle.left + window.scrollX}px`;
loaderOverlay.style.width = `${bodyRectangle.width}px`;
loaderOverlay.style.height = `${bodyRectangle.height}px`;
});
Expand Down
84 changes: 49 additions & 35 deletions lib/WeBWorK/ContentGenerator/Grades.pm
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,22 @@ sub displayStudentGrades ($c) {
# Determine if set is a test and if it is a test template or version.
my $setIsTest = defined $set->assignment_type && $set->assignment_type =~ /gateway/;
my $setIsVersioned = $setIsTest && !defined $setVersionsCount{$setID};
my $setTemplateID = $set->set_id;

# Initialize set item. Define link here. It will be adjusted for versioned tests later.
my $item = {
name => format_set_name_display($setID),
name => format_set_name_display($setTemplateID),
grade => 0,
grade_total => 0,
grade_total_right => 0,
is_test => $setIsTest,
record => $set,
link => $c->systemLink(
$c->url_for('problem_list', setID => $setID),
$c->url_for(
$setIsVersioned ? 'gateway_quiz_version' : 'problem_list',
setID => $setTemplateID,
versionID => $set->version_id
),
params => { effectiveUser => $effectiveUser }
)
};
Expand Down Expand Up @@ -248,30 +253,26 @@ sub displayStudentGrades ($c) {
next;
}

# Only add link if the problems can be seen.
$item->{link} =
($set->hide_work eq 'N' || ($set->hide_work eq 'BeforeAnswerDate' && time >= $set->answer_date))
? $c->systemLink(
$c->url_for(
$set->assignment_type eq 'proctored_gateway'
? 'proctored_gateway_quiz_version'
: 'gateway_quiz_version',
setID => $setID,
versionID => $set->version_id
),
params => { effectiveUser => $effectiveUser }
)
: '';
# Only show link if the problems can be seen, and it is not a proctored test
# since students cannot directly access them until after it is graded, at
# which time it reverts to a normal test.
$item->{link} = ''
if $set->assignment_type eq 'proctored_gateway'
|| (
defined $set->hide_work
&& ($set->hide_work eq 'Y'
|| $set->hide_work eq 'BeforeAnswerDate' && time < $set->answer_date)
);
Comment on lines +256 to +265

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should show the link for a problem in a proctored test in the case that the user viewing the grades has the proctor_quiz_login permission. In that case, the user has access to the test anyway (and no longer even needs to enter proctor authentication to do so).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall design of the grades page in my redesign was to only show what a student would see and not have lots of conditions to show users acting as a student additional stuff. I could do that here, but there are lots of other places information is shown based on only what a student can see (for instance there is no condition for when the user has the view_hidden_work permission here).

If someone wants to go add all those additional conditions and permissions, they could, but my original design left that out. The instructor's student progress page can be used to gain access to all that information if needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. That is fine.


# If the set has hide_score set, then nothing left to do.
if (defined $set->hide_score && $set->hide_score eq 'Y'
|| ($set->hide_score eq 'BeforeAnswerDate' && time < $set->answer_date))
{
next;
}
next
if defined $set->hide_score
&& ($set->hide_score eq 'Y'
|| $set->hide_score eq 'BeforeAnswerDate' && time < $set->answer_date);

# This is a test version, and the scores can be shown, so also show score of template set.
$allItems{$setID}{message} = '' if $allItems{$setID}{hide_score};
$allItems{$setID}{hide_score} = 0;
$allItems{$setTemplateID}{message} = '' if $allItems{$setTemplateID}{hide_score};
$allItems{$setTemplateID}{hide_score} = 0;
}

my ($total_right, $total, $problem_scores, $problem_incorrect_attempts, $problem_records) =
Expand All @@ -288,13 +289,15 @@ sub displayStudentGrades ($c) {
if ($setIsTest && defined $set->hide_score_by_problem && $set->hide_score_by_problem eq 'Y') {
$item->{message} = $c->maketext('Display of problem scores for this test is not allowed.');
} else {
# Create a direct link to the problems unless the set is a test, or there is a set
# restriction preventing the student from accessing the set problems.
my $noProblemLink =
$setIsTest
|| restricted_set_message($c, $set, 'lti')
|| restricted_set_message($c, $set, 'conditional')
|| $authz->invalidIPAddress($set);
# Create a direct link to the problems unless there is a set/test restriction preventing the
# student from accessing the set problems.
my $noProblemLink = !$item->{link}
|| (
!$setIsTest
&& (restricted_set_message($c, $set, 'lti')
|| restricted_set_message($c, $set, 'conditional')
|| $authz->invalidIPAddress($set))
);

for my $i (0 .. $#$problem_scores) {
my $addProblem = 1;
Expand All @@ -315,10 +318,21 @@ sub displayStudentGrades ($c) {
id => $problem_id,
score => $problem_scores->[$i] =~ /^\d+$/ ? $problem_scores->[$i] : 0,
value => $problem_records->[$i]{value},
link => $noProblemLink ? '' : $c->systemLink(
$c->url_for('problem_detail', setID => $setID, problemID => $problem_id),
params => { effectiveUser => $effectiveUser }
),
link => $noProblemLink ? '' : $setIsTest ? $c->systemLink(
$c->url_for(
'gateway_quiz_version',
setID => $setTemplateID,
versionID => $set->version_id
),
params => {
effectiveUser => $effectiveUser,
currentPage => int($i / ($set->problems_per_page || 1)) + 1
}
)
. "#prob$i" : $c->systemLink(
$c->url_for('problem_detail', setID => $setID, problemID => $problem_id),
params => { effectiveUser => $effectiveUser }
),
attempts => $setIsTest
? 0
: $problem_incorrect_attempts->[$i] + $problem_records->[$i]->num_correct
Expand All @@ -330,7 +344,7 @@ sub displayStudentGrades ($c) {
# If this is a test version, update template set to the best grade a student hand.
if ($setIsVersioned) {
# Compare the score to the template set and update as needed.
my $templateItem = $allItems{$setID};
my $templateItem = $allItems{$setTemplateID};
if ($templateItem->{grade} == 0 || $item->{grade} > $templateItem->{grade}) {
$templateItem->{version_id} = $set->version_id;
$templateItem->{version_link} = $item->{link};
Expand Down