Skip to content

Remove reducedScoring from PG. #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
58 changes: 7 additions & 51 deletions macros/PGanswermacros.pl
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ =head1 DESCRIPTION
my $functVarDefault;
# ^variable my $useBaseTenLog
my $useBaseTenLog;
# ^variable my $reducedScoringDate
my $reducedScoringDate;
# ^variable my $reducedScoringValue
my $reducedScoringValue;
# ^variable my $enable_reduced_scoring
my $enable_reduced_scoring;
# ^variable my $dueDate
my $dueDate;

Expand All @@ -165,9 +159,6 @@ =head1 DESCRIPTION
# ^uses $envir{functULimitDefault}
# ^uses $envir{functVarDefault}
# ^uses $envir{useBaseTenLog}
# ^uses $envir{reducedScoringDate}
# ^uses $envir{reducedScoringValue}
# ^uses $envir{enable_reduced_scoring}
# ^uses $envir{dueDate}

sub _PGanswermacros_init {
Expand All @@ -181,9 +172,6 @@ sub _PGanswermacros_init {
$functULimitDefault = PG_restricted_eval(q/$envir{functULimitDefault}/);
$functVarDefault = PG_restricted_eval(q/$envir{functVarDefault}/);
$useBaseTenLog = PG_restricted_eval(q/$envir{useBaseTenLog}/);
$reducedScoringDate = PG_restricted_eval(q/$envir{reducedScoringDate}/);
$reducedScoringValue= PG_restricted_eval(q/$envir{reducedScoringValue}/);
$enable_reduced_scoring = $reducedScoringDate ? PG_restricted_eval(q/$envir{enable_reduced_scoring}/) : 0;
$dueDate = PG_restricted_eval(q/$envir{dueDate}/);
}

Expand Down Expand Up @@ -1522,20 +1510,10 @@ sub std_problem_grader {
$problem_state{num_of_correct_ans}++ if $allAnswersCorrectQ == 1;
$problem_state{num_of_incorrect_ans}++ if $allAnswersCorrectQ == 0;
$problem_state{recorded_score} = 0 unless defined $problem_state{recorded_score};
# Determine if we are in the reduced scoring period and act accordingly
if (!$enable_reduced_scoring or time() < $reducedScoringDate) { # the reduced scoring period is disabled or it is before the reduced scoring period
# FIXME: This check should be moved out of PG, webwork should do this check instead.
if (time() < $dueDate) {
# increase recorded score if the current score is greater.
$problem_state{recorded_score} = $problem_result{score} if $problem_result{score} > $problem_state{recorded_score};
# the sub_recored_score holds the recored_score before entering the reduced scoring period
$problem_state{sub_recorded_score} = $problem_state{recorded_score};
}
elsif (time() < $dueDate) { # we are in the reduced scoring period.
# student gets credit for all work done before the reduced scoring period plus a portion of work done during period
my $newScore = 0;
$newScore = $problem_state{sub_recorded_score} + $reducedScoringValue*($problem_result{score} - $problem_state{sub_recorded_score}) if ($problem_result{score} > $problem_state{sub_recorded_score});
$problem_state{recorded_score} = $newScore if $newScore > $problem_state{recorded_score};
my $reducedScoringPerCent = int(100*$reducedScoringValue+.5);
$problem_result{msg} = $problem_result{msg}."<br />You are in the Reduced Scoring Period: All additional work done counts $reducedScoringPerCent\% of the original.";
}

$problem_state{state_summary_msg} = ''; # an HTML formatted message printed at the bottom of the problem page
Expand Down Expand Up @@ -1624,23 +1602,13 @@ sub std_problem_grader2 {
$problem_result{score} = $allAnswersCorrectQ;
$problem_state{recorded_score} = 0 unless defined $problem_state{recorded_score};

# Determine if we are in the reduced scoring period and act accordingly
if (!$enable_reduced_scoring or time() < $reducedScoringDate) { # the reduced scoring period is disabled or it is before the reduced scoring period
# FIXME: This check should be moved out of PG, webwork should do this check instead.
if (time() < $dueDate) {
# increase recorded score if the current score is greater.
$problem_state{recorded_score} = $problem_result{score} if $problem_result{score} > $problem_state{recorded_score};
# the sub_recored_score holds the recored_score before entering the reduced scoring period
$problem_state{sub_recorded_score} = $problem_state{recorded_score};
}
elsif (time() < $dueDate) { # we are in the reduced scoring period.
# student gets credit for all work done before the reduced scoring period plus a portion of work done during period
my $newScore = 0;
$newScore = $problem_state{sub_recorded_score} + $reducedScoringValue*($problem_result{score} - $problem_state{sub_recorded_score}) if ($problem_result{score} > $problem_state{sub_recorded_score});
$problem_state{recorded_score} = $newScore if $newScore > $problem_state{recorded_score};
my $reducedScoringPerCent = int(100*$reducedScoringValue+.5);
$problem_result{msg} = $problem_result{msg}."<br />You are in the Reduced Scoring Period: All additional work done counts $reducedScoringPerCent\% of the original.";
}
# record attempt only if there have been no syntax errors.

# record attempt only if there have been no syntax errors.
if ($record_problem_attempt == 1) {
$problem_state{num_of_correct_ans}++ if $allAnswersCorrectQ == 1;
$problem_state{num_of_incorrect_ans}++ if $allAnswersCorrectQ == 0;
Expand Down Expand Up @@ -1717,22 +1685,10 @@ sub avg_problem_grader {
$problem_state{num_of_correct_ans}++ if $total == $count;
$problem_state{num_of_incorrect_ans}++ if $total < $count;

# Determine if we are in the reduced scoring period and if the reduced scoring period is enabled and act accordingly
#warn("enable_reduced_scoring is $enable_reduced_scoring");
# warn("dueDate is $dueDate");
if (!$enable_reduced_scoring or time() < $reducedScoringDate) { # the reduced scoring period is disabled or it is before the reduced scoring period
# FIXME: This check should be moved out of PG, webwork should do this instead.
if (time() < $dueDate) {
# increase recorded score if the current score is greater.
$problem_state{recorded_score} = $problem_result{score} if $problem_result{score} > $problem_state{recorded_score};
# the sub_recored_score holds the recored_score before entering the reduced scoring period
$problem_state{sub_recorded_score} = $problem_state{recorded_score};
}
elsif (time() < $dueDate) { # we are in the reduced scoring period.
# student gets credit for all work done before the reduced scoring period plus a portion of work done during period
my $newScore = 0;
$newScore = $problem_state{sub_recorded_score} + $reducedScoringValue*($problem_result{score} - $problem_state{sub_recorded_score}) if ($problem_result{score} > $problem_state{sub_recorded_score});
$problem_state{recorded_score} = $newScore if $newScore > $problem_state{recorded_score};
my $reducedScoringPerCent = int(100*$reducedScoringValue+.5);
$problem_result{msg} = $problem_result{msg}."<br />You are in the Reduced Scoring Period: All additional work done counts $reducedScoringPerCent\% of the original.";
}

$problem_state{state_summary_msg} = ''; # an HTML formatted message printed at the bottom of the problem page
Expand Down
17 changes: 2 additions & 15 deletions macros/PGgraders.pl
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,10 @@ sub custom_problem_grader_fluid {

$problem_result{score} = $total;

# Determine if we are in the reduced scoring period and if the reduced scoring period is enabled and act accordingly
#warn("enable_reduced_scoring is $enable_reduced_scoring");
#warn("dueDate is $dueDate");

if (!$enable_reduced_scoring or time() < $reducedScoringDate) { # the reduced scoring period is disabled or it is before the reduced scoring period
# FIXME: This check should be moved out of PG, webwork should do this check instead.
if (time() < $dueDate) {
# increase recorded score if the current score is greater.
$problem_state{recorded_score} = $problem_result{score} if $problem_result{score} > $problem_state{recorded_score};
# the sub_recored_score holds the recored_score before entering the reduced scoring period
$problem_state{sub_recorded_score} = $problem_state{recorded_score};
}
elsif (time() < $dueDate) { # we are in the reduced scoring period.
# student gets credit for all work done before the reduced scoring period plus a portion of work done during period
my $newScore = 0;
$newScore = $problem_state{sub_recorded_score} + $reducedScoringValue*($problem_result{score} - $problem_state{sub_recorded_score}) if ($problem_result{score} > $problem_state{sub_recorded_score});
$problem_state{recorded_score} = $newScore if $newScore > $problem_state{recorded_score};
my $reducedScoringPerCent = int(100*$reducedScoringValue+.5);
$problem_result{msg} = $problem_result{msg}."<br />You are in the Reduced Scoring Period: All additional work done counts $reducedScoringPerCent\% of the original.";
}

(\%problem_result, \%problem_state);
Expand Down