module GradeInterface;

  from Questions import all;
  from Tests import all;
  from Autograde import SumLengths;

  operation ManualGrade is
    inputs: t:GradedTest, q:Question, s:Score, c:Comment;
    outputs: t':GradedTest;
    postcondition:
    (*
     * The question is updated with the new grade & comment
     *)
      forall(i:integer | i >= 1 and i < #t.questions)
        forall(j:integer | j >= 1 and j < #t.questions[i].qs and t.questions[i].qs[j] = q)
          (t'.s[SumLengths(t.questions[0:i])+j] = s and t'.c[SumLengths(t.questions[0:i])+j] = c);
  end;
  
end GradeInterface;