@@ -118,6 +118,10 @@ sub can_showSolutions ($c, $user, $permissionLevel, $effectiveUser, $set, $probl
118118# Allow for a version_last_attempt_time which is the time the set was submitted. If that is present we use that instead
119119# of the current time to decide if answers can be recorded. This deals with the time between the submission time and
120120# the proctor authorization.
121+ # IMPORTANT: This method is called directly by the LoginProctor.pm package without a proper GatewayQuiz object, and so
122+ # it can not call any of the object methods in the GatewayQuiz package or use anything that is not set for a generic
123+ # ContentGenerator object. Also make sure that the conditions for recording an unsubmitted test are kept in sync with
124+ # the conditions of the can_gradeUnsubmittedTest method.
121125sub can_recordAnswers ($c , $user , $permissionLevel , $effectiveUser , $set , $problem , $tmplSet = 0, $submitAnswers = 0) {
122126 my $authz = $c -> authz;
123127
@@ -130,8 +134,12 @@ sub can_recordAnswers ($c, $user, $permissionLevel, $effectiveUser, $set, $probl
130134 # allow that between the open and close dates, and so drop out of this conditional to the usual one.
131135 return 1
132136 if $authz -> hasPermissions($user -> user_id, ' record_answers_when_acting_as_student' )
133- || $c -> can_gradeUnsubmittedTest($user , $permissionLevel , $effectiveUser , $set , $problem , $tmplSet ,
134- $submitAnswers );
137+ || (!$submitAnswers
138+ && $authz -> hasPermissions($user -> user_id, ' access_instructor_tools' )
139+ && $authz -> hasPermissions($user -> user_id, ' problem_grader' )
140+ && !$c -> {invalidSet }
141+ && after($set -> due_date + $c -> ce-> {gatewayGracePeriod })
142+ && !$set -> version_last_attempt_time);
135143 return 0 if !$authz -> hasPermissions($user -> user_id, ' record_set_version_answers_when_acting_as_student' );
136144 }
137145
0 commit comments