-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(statsType): simplification of type
- submissionExists not used anymore - ancestor and main stats jbuilder refactored - since both are having quite similar structure, redefine some jbuilder
- Loading branch information
1 parent
c1f1a85
commit dab21cb
Showing
8 changed files
with
43 additions
and
71 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
app/views/course/statistics/assessments/_answer.json.jbuilder
This file contains 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.grader do | ||
json.id grader&.id || 0 | ||
json.name grader&.name || 'System' | ||
end | ||
|
||
json.answers answers.each do |answer| | ||
json.id answer.id | ||
json.grade answer.grade | ||
json.maximumGrade @question_maximum_grade_hash[answer.question_id] | ||
end |
7 changes: 7 additions & 0 deletions
7
app/views/course/statistics/assessments/_assessment.json.jbuilder
This file contains 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,7 @@ | ||
# frozen_string_literal: true | ||
json.id assessment.id | ||
json.title assessment.title | ||
json.startAt assessment.start_at&.iso8601 | ||
json.endAt assessment.end_at&.iso8601 | ||
json.maximumGrade assessment.maximum_grade | ||
json.url course_assessment_path(course, assessment) |
7 changes: 7 additions & 0 deletions
7
app/views/course/statistics/assessments/_course_user.json.jbuilder
This file contains 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,7 @@ | ||
# frozen_string_literal: true | ||
json.courseUser do | ||
json.id course_user.id | ||
json.name course_user.name | ||
json.role course_user.role | ||
json.isPhantom course_user.phantom? | ||
end |
9 changes: 9 additions & 0 deletions
9
app/views/course/statistics/assessments/_submission.json.jbuilder
This file contains 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,9 @@ | ||
# frozen_string_literal: true | ||
if submission.nil? | ||
json.workflowState 'unstarted' | ||
else | ||
json.workflowState submission.workflow_state | ||
json.submittedAt submission.submitted_at&.iso8601 | ||
json.endAt end_at&.iso8601 | ||
json.totalGrade submission.grade | ||
end |
24 changes: 3 additions & 21 deletions
24
app/views/course/statistics/assessments/ancestor_statistics.json.jbuilder
This file contains 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,27 +1,9 @@ | ||
# frozen_string_literal: true | ||
json.assessment do | ||
json.id @assessment.id | ||
json.title @assessment.title | ||
json.startAt @assessment.start_at&.iso8601 | ||
json.endAt @assessment.end_at&.iso8601 | ||
json.maximumGrade @assessment.maximum_grade | ||
json.url course_assessment_path(current_course, @assessment) | ||
json.partial! 'assessment', assessment: @assessment, course: current_course | ||
end | ||
|
||
json.submissions @student_submissions_hash.each do |course_user, (submission, end_at)| | ||
json.courseUser do | ||
json.id course_user.id | ||
json.name course_user.name | ||
json.role course_user.role | ||
json.isPhantom course_user.phantom? | ||
end | ||
|
||
if submission.nil? | ||
json.workflowState 'unstarted' | ||
else | ||
json.workflowState submission.workflow_state | ||
json.submittedAt submission.submitted_at&.iso8601 | ||
json.endAt end_at&.iso8601 | ||
json.totalGrade submission.grade | ||
end | ||
json.partial! 'course_user', course_user: course_user | ||
json.partial! 'submission', submission: submission, end_at: end_at | ||
end |
42 changes: 6 additions & 36 deletions
42
app/views/course/statistics/assessments/main_statistics.json.jbuilder
This file contains 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 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 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