Skip to content

Commit

Permalink
Make the set progress bar work with unreduced scores for determining …
Browse files Browse the repository at this point in the history
…correctness/completion of a problem.

The siblings problem list shows a checkmark by problems for which the
maximum possible score has been obtained, even if that is not 100% for
the problem due to being in the reduced scoring period.  Also when all
problems are complete in the set and there are problems with reduced
scores, then the progress bar shows "Complete" without stars instead of
the usual "Perfect" with stars.

Also mark "Perfect" for translation.  For some reason it was not before.
  • Loading branch information
drgrice1 committed Jan 18, 2024
1 parent b7b67f2 commit 1b1098b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/WeBWorK/ContentGenerator/Problem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ use WeBWorK::Utils qw(decodeAnswers is_restricted path_is_subdir before after be
wwRound is_jitar_problem_closed is_jitar_problem_hidden jitar_problem_adjusted_status
jitar_id_to_seq seq_to_jitar_id jitar_problem_finished format_set_name_display);
use WeBWorK::Utils::Rendering qw(getTranslatorDebuggingOptions renderPG);
use WeBWorK::Utils::ProblemProcessing qw/process_and_log_answer jitar_send_warning_email compute_reduced_score/;
use WeBWorK::Utils::ProblemProcessing qw(process_and_log_answer jitar_send_warning_email compute_reduced_score
compute_unreduced_score);
use WeBWorK::AchievementEvaluator qw(checkForAchievements);
use WeBWorK::DB::Utils qw(global2user);
use WeBWorK::Localize;
Expand Down Expand Up @@ -738,6 +739,7 @@ sub siblings ($c) {
my $total_correct = 0;
my $total_incorrect = 0;
my $total_inprogress = 0;
my $is_reduced = 0;
my $currentProblemID = $c->{invalidProblem} ? 0 : $c->{problem}->problem_id;

my $progressBarEnabled = $c->ce->{pg}{options}{enableProgressBar};
Expand All @@ -762,7 +764,8 @@ sub siblings ($c) {
$num_of_problems++;
my $total_attempts = $problemRecord->num_correct + $problemRecord->num_incorrect;

my $status = $problemRecord->status;
my $status = compute_unreduced_score($ce, $problemRecord, $c->{set});
$is_reduced = 1 if $status > $problemRecord->status;
if ($isJitarSet) {
$status = jitar_problem_adjusted_status($problemRecord, $db);
}
Expand Down Expand Up @@ -841,6 +844,7 @@ sub siblings ($c) {
total_correct => $total_correct,
total_incorrect => $total_incorrect,
total_inprogress => $total_inprogress,
is_reduced => $is_reduced
);
}

Expand Down
9 changes: 7 additions & 2 deletions templates/ContentGenerator/Problem/siblings.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@
aria-label="correct progress bar for current problem set" role="figure"
data-bs-toggle="tooltip" data-bs-placement="bottom" tabindex="0"
data-bs-title="<%= maketext('Correct: [_1]/[_2]', $total_correct, $num_of_problems) %>">
% # Perfect scores deserve some stars (&#9733;)!
% if ($total_correct == $num_of_problems) {
&#9733;Perfect&#9733;
% if ($is_reduced) {
% # If any of the scores are reduced the set is not perfect. It is merely complete.
<%= maketext('Complete') %>
% } else {
% # Perfect scores deserve some stars (&#9733;)!
&#9733;<%= maketext('Perfect') %>&#9733;
% }
% }
</div>
% }
Expand Down

0 comments on commit 1b1098b

Please sign in to comment.