-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
List own courses first when copying a course #3049
Conversation
@featured_courses = @courses.where(featured: true) | ||
@own_courses = @courses.where(featured: false) | ||
.reorder(year: :desc, name: :asc) | ||
.select { |course| current_user.course_admin?(course) } | ||
@other_courses = @courses.where(featured: false) | ||
.reorder(year: :desc, name: :asc) | ||
.reject { |course| current_user.course_admin?(course) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@featured_courses = @courses.where(featured: true) | |
@own_courses = @courses.where(featured: false) | |
.reorder(year: :desc, name: :asc) | |
.select { |course| current_user.course_admin?(course) } | |
@other_courses = @courses.where(featured: false) | |
.reorder(year: :desc, name: :asc) | |
.reject { |course| current_user.course_admin?(course) } | |
featured_courses = @courses.where(featured: true) | |
own_courses = @courses.where(featured: false) | |
.reorder(year: :desc, name: :asc) | |
.select { |course| current_user.course_admin?(course) } | |
other_courses = @courses.where(featured: false) | |
.reorder(year: :desc, name: :asc) | |
.reject { |course| current_user.course_admin?(course) } | |
@courses = featured_courses + own_courses + other_courses |
This way, no changes to the HTML are necessary. (Make sure to check this locally, I'm not entirely sure if the +
works if the actual data hasn't been loaded yet.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can look at the server log to see the actual error. Probably an explicit load is necessary for the featured_courses
.
This pull request lists the user's own courses (course admin) first in the course table when copying a course. To accomplish this, I split up the courses into 2 sets, one where the user is course admin of the courses and one where the user is not course admin.
Closes #1661.