-
Notifications
You must be signed in to change notification settings - Fork 78
Programming Question Audit Trail #7595
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
Open
syoopie
wants to merge
21
commits into
master
Choose a base branch
from
yupei/programming-question-audit-trail
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
279543d
feat(programming-audit-trail): modify db
syoopie 68210be
feat(programming-audit-trail): preserve old questions and tests
syoopie 63333dc
feat(custom-slider): add custom slider
syoopie c57737a
feat(accordion): expand accordion functionality
syoopie 22598a7
refactor(all-attempts-display): update accordion
syoopie 0275404
refactor(statistics): change naming of types
syoopie 7824df6
refactor(all-attempts-display): use new slider
syoopie 6a21214
refactor(all-attempts-display): change created_at to submitted_at
syoopie 3b43451
feat(all-attempts-display): add more programming question details
syoopie 58c38e0
refactor(statistics): use seperate API for latest answer
syoopie fade06b
feat(statistics-marks-table): add card to dialog
syoopie 6b321ad
feat(statistics): add BE support for multiple tests / questions
syoopie 913ecc1
feat(statistics): multiple regrading view for attempts
syoopie 5c299df
feat(regrading): only regrade current_answer on question edit
syoopie 61bbcba
test(stats-answer-controller): rename function calls
syoopie 4b28d7f
test(programming-controller): fix tests
syoopie 398d617
test(programming-management): fix tests
syoopie 7b6a998
test(programming-management): fix template package spec
syoopie bcd5746
fix(attempt-count-table): fix error when attempt does not exist
syoopie 5d88122
test(test-case-view): fix FE test
syoopie 9183fd7
refactor(pastAnswer): follow audit trail
bivanalhar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
app/controllers/course/assessment/submission_question/submission_questions_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Course::Statistics::AnswersHelper | ||
| def get_historical_auto_gradings(programming_auto_grading) | ||
| historical = [] | ||
| current = programming_auto_grading | ||
|
|
||
| while current&.parent_id | ||
| parent = Course::Assessment::Answer::ProgrammingAutoGrading.find_by(id: current.parent_id) | ||
| historical.unshift(parent) if parent | ||
| current = parent | ||
| end | ||
|
|
||
| historical | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ews/course/assessment/submission_question/submission_questions/past_answers.json.jbuilder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # frozen_string_literal: true | ||
| json.answers answers do |answer| | ||
| json.partial! answer, answer: answer | ||
| json.partial! 'course/statistics/answers/answer', answer: answer, question: question | ||
| end |
11 changes: 11 additions & 0 deletions
11
app/views/course/statistics/answers/_all_questions.json.jbuilder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| json.allQuestions @all_actable_questions do |question| | ||
| json.id question.id | ||
| json.title question.title | ||
| json.maximumGrade question.maximum_grade | ||
| json.description format_ckeditor_rich_text(question.description) | ||
| json.type question.question_type | ||
|
|
||
| json.partial! question, question: question, can_grade: false, answer: @all_answers.first | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # frozen_string_literal: true | ||
| specific_answer = answer.specific | ||
|
|
||
| json.id answer.id | ||
| json.grade answer.grade | ||
| json.questionType question.question_type | ||
|
|
||
| if answer.actable_type == Course::Assessment::Answer::Programming.name | ||
| json.partial! 'course/statistics/answers/programming_answer', answer: specific_answer, can_grade: false | ||
| else | ||
| json.partial! specific_answer, answer: specific_answer, can_grade: false | ||
| end | ||
|
|
||
| if answer.actable_type == Course::Assessment::Answer::Programming.name | ||
| files = answer.specific.files | ||
| json.partial! 'course/assessment/answer/programming/annotations', programming_files: files, | ||
| can_grade: false | ||
| posts = files.flat_map(&:annotations).map(&:discussion_topic).flat_map(&:posts) | ||
|
|
||
| json.posts posts do |post| | ||
| json.partial! post, post: post if post.published? | ||
| end | ||
| end | ||
|
|
||
| json.submittedAt answer.submitted_at&.iso8601 | ||
| json.currentAnswer answer.current_answer | ||
| json.workflowState answer.workflow_state |
74 changes: 74 additions & 0 deletions
74
app/views/course/statistics/answers/_programming_answer.json.jbuilder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # frozen_string_literal: true | ||
| question = @question.specific | ||
|
|
||
| # If a non current_answer is being loaded, use it instead of loading the last_attempt. | ||
| is_current_answer = answer.current_answer? | ||
| latest_answer = last_attempt(answer) | ||
| attempt = is_current_answer ? latest_answer : answer | ||
| auto_grading = attempt&.auto_grading&.specific | ||
|
|
||
| json.fields do | ||
| json.questionId answer.question_id | ||
| json.id answer.acting_as.id | ||
| json.files_attributes answer.files do |file| | ||
| json.(file, :id, :filename) | ||
| json.content file.content | ||
| json.highlightedContent highlight_code_block(file.content, question.language) | ||
| end | ||
| end | ||
|
|
||
| can_read_tests = can?(:read_tests, @submission) | ||
| show_private = can_read_tests || (@submission.published? && @assessment.show_private?) | ||
| show_evaluation = can_read_tests || (@submission.published? && @assessment.show_evaluation?) | ||
|
|
||
| test_cases_by_type = question.test_cases_by_type | ||
| test_cases_and_results = get_test_cases_and_results(test_cases_by_type, auto_grading) | ||
|
|
||
| show_stdout_and_stderr = (can_read_tests || current_course.show_stdout_and_stderr) && | ||
| auto_grading && auto_grading&.exit_code != 0 | ||
|
|
||
| displayed_test_case_types = ['public_test'] | ||
| displayed_test_case_types << 'private_test' if show_private | ||
| displayed_test_case_types << 'evaluation_test' if show_evaluation | ||
|
|
||
| historical_auto_gradings = get_historical_auto_gradings(auto_grading) | ||
|
|
||
| json.testCases (historical_auto_gradings + [auto_grading]).each do |ag| | ||
| next if ag.nil? # To account for autogradings with no test results (programming with no autograding) | ||
|
|
||
| question = ag.test_results.first.test_case ? ag.test_results.first.test_case.question : @question.actable | ||
| test_cases_by_type = question.test_cases_by_type | ||
| test_cases_and_results = get_test_cases_and_results(test_cases_by_type, ag) | ||
|
|
||
| json.canReadTests can_read_tests | ||
| json.questionId question.id | ||
| displayed_test_case_types.each do |test_case_type| | ||
| show_public = (test_case_type == 'public_test') && current_course.show_public_test_cases_output | ||
| show_testcase_outputs = can_read_tests || show_public | ||
| json.set! test_case_type do | ||
| if test_cases_and_results[test_case_type].present? | ||
| json.array! test_cases_and_results[test_case_type] do |test_case, test_result| | ||
| json.identifier test_case.identifier if can_read_tests | ||
| json.expression test_case.expression | ||
| json.expected test_case.expected | ||
| if test_result | ||
| json.output get_output(test_result) if show_testcase_outputs | ||
| json.passed test_result.passed? | ||
| end | ||
| end | ||
|
|
||
| end | ||
| end | ||
| json.(ag, :stdout, :stderr) if show_stdout_and_stderr | ||
| end | ||
| end | ||
|
|
||
| if answer.codaveri_feedback_job_id && question.is_codaveri | ||
| codaveri_job = answer.codaveri_feedback_job | ||
| json.codaveriFeedback do | ||
| json.jobId answer.codaveri_feedback_job_id | ||
| json.jobStatus codaveri_job.status | ||
| json.jobUrl job_path(codaveri_job) if codaveri_job.status == 'submitted' | ||
| json.errorMessage codaveri_job.error['message'] if codaveri_job.error | ||
| end | ||
| end |
7 changes: 3 additions & 4 deletions
7
app/views/course/statistics/answers/all_answers.json.jbuilder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.