Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/api/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def serialize_course(course)
{
id: course.id,
name: course.name,
prof: current_user.course_professor?(course)
prof: current_user.course_professor?(course),
last_reg_update: course.last_reg_update.iso8601,
}
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,8 @@ def unpublished_grades_query
.order("users.name")
.select("DISTINCT submissions.*", "users.name AS user_name")
end

def last_reg_update
course.registrations.order(updated_at: :desc).first.updated_at
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silly me, I forgot Ruby has .last. So this could be terser as .order(:updated_at).last

end
end