Skip to content

Commit d1ad4a1

Browse files
committed
course: last_reg_update field in API for hourglass
1 parent 2e28fbe commit d1ad4a1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/controllers/api/courses_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def serialize_course(course)
1919
{
2020
id: course.id,
2121
name: course.name,
22-
prof: current_user.course_professor?(course)
22+
prof: current_user.course_professor?(course),
23+
last_reg_update: course.last_reg_update.iso8601,
2324
}
2425
end
2526
end

app/models/course.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,8 @@ def unpublished_grades_query
340340
.order("users.name")
341341
.select("DISTINCT submissions.*", "users.name AS user_name")
342342
end
343+
344+
def last_reg_update
345+
course.registrations.order(updated_at: :desc).first.updated_at
346+
end
343347
end

0 commit comments

Comments
 (0)