-
Notifications
You must be signed in to change notification settings - Fork 75
/
index.json.jbuilder
34 lines (30 loc) · 1.08 KB
/
index.json.jbuilder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true
submissions_hash ||= @submissions.map { |s| [s.course_user_id, s] }.to_h
json.assessment do
json.title @assessment.title
json.maximumGrade @assessment.maximum_grade.to_f
json.gamified current_course.gamified?
json.downloadable @assessment.downloadable?
json.passwordProtected @assessment.password_protected?
end
my_students_set = Set.new(@my_students.map(&:id))
json.submissions @course_students do |course_student|
json.courseStudent do
json.(course_student, :id, :name)
json.path course_user_path(current_course, course_student)
json.phantom course_student.phantom?
json.myStudent my_students_set.include?(course_student.id)
end
submission = submissions_hash[course_student.id]
if submission
json.id submission.id
json.workflowState submission.workflow_state
json.grade submission.grade.to_f
json.pointsAwarded submission.current_points_awarded
json.dateSubmitted submission.submitted_at
json.dateGraded submission.graded_at
json.logCount submission.log_count
else
json.workflowState 'unstarted'
end
end