Skip to content

Commit 1c65185

Browse files
committed
refactor(pastAnswer): follow audit trail
1 parent e3dd836 commit 1c65185

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

app/controllers/course/assessment/submission_question/submission_questions_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# frozen_string_literal: true
22
class Course::Assessment::SubmissionQuestion::SubmissionQuestionsController < \
33
Course::Assessment::SubmissionQuestion::Controller
4+
helper Course::Statistics::AnswersHelper.name.sub(/Helper$/, '')
5+
46
def past_answers
57
answers_to_load = past_answers_params[:answers_to_load]&.to_i || 10
68
answers = @submission_question.past_answers(answers_to_load)
9+
@question = @submission_question.question
710

811
respond_to do |format|
9-
format.json { render 'past_answers', locals: { answers: answers } }
12+
format.json { render 'past_answers', locals: { answers: answers, question: @question } }
1013
end
1114
end
1215

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# frozen_string_literal: true
22
json.answers answers do |answer|
3-
json.partial! answer, answer: answer
3+
json.partial! 'course/statistics/answers/answer', answer: answer, question: question
44
end

client/app/bundles/course/assessment/submission/containers/TestCaseView/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ function mapStateToProps({ assessments: { submission } }, ownProps) {
411411
let testCases;
412412
let isAutograding;
413413
if (viewHistory) {
414-
testCases = submission.history.testCases[answerId];
414+
testCases = submission.history.testCases[answerId][0];
415415
isAutograding = false;
416416
} else {
417417
testCases = submission.testCases[questionId];

0 commit comments

Comments
 (0)