-
Notifications
You must be signed in to change notification settings - Fork 77
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
Remove squeel queries from codebase #2283
Remove squeel queries from codebase #2283
Conversation
end | ||
|
||
def ended | ||
where { (end_at == nil) | (end_at >= Time.zone.now) } | ||
where.has { (end_at == nil) | (end_at >= Time.zone.now) } |
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.
Prefer the use of the nil? predicate.
@@ -8,11 +8,11 @@ def currently_active | |||
private | |||
|
|||
def started | |||
where { (start_at == nil) | (start_at <= Time.zone.now) } | |||
where.has { (start_at == nil) | (start_at <= Time.zone.now) } |
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.
Prefer the use of the nil? predicate.
merge(Course::GroupUser.normal). | ||
where { group_users.group_id == group_id } | ||
course.course_users.joins(:group_users).where('course_group_users.group_id = ?', group_id) | ||
merge(Course::GroupUser.normal) |
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.
Inconsistent indentation detected.
@experience_points_records.active.includes { actable }. | ||
includes(:updater).order(updated_at: :desc).page(page_param) | ||
@experience_points_records.active.includes(:actable, :updater).order(updated_at: :desc). | ||
page(page_param) |
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.
Align page with @experience_points_records.active.includes(:actable, :updater).order(updated_at: :desc). on line 16.
238aacd
to
766f7c6
Compare
- Previously, renderComponent(response.data) was called before the document was ready.
766f7c6
to
86fdabd
Compare
merge(Course::GroupUser.normal). | ||
where { group_users.group_id == group_id } | ||
course.course_users.joins(:group_users).where('course_group_users.group_id = ?', group_id). | ||
merge(Course::GroupUser.normal) |
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.
Use 2 (not 0) spaces for indenting an expression spanning multiple lines.
- This commit attempts to remove most of squeel APIs. However, note that squeel is still bundled as part of the cancancan-squeel, which fixes some of Coursemology's cancancan issues (self-joins, etc). - The changes are aimed at using pure ActiveRecord methods which enables easier upgrading in the future. In cases where AR is insufficient, baby_squeel is used.
86fdabd
to
ea1ac14
Compare
👍 |
Starts #2271. Squeel is not being maintained now, hence removing all dependencies on it would be useful.
This PR removes all Squeel queries from Coursemology, and replaces them with vanilla ActiveRecord and baby_squeel (aimed at replacing Squeel, without monkey-patching ActiveRecord). For most parts, I've opted to stick to normal Activerecord to ensure easier upgrade paths in the future.
Note that however,
cancancan-squeel
, which has a dependency on squeel, is still installed. This is because thecancancan-squeel
adapter does fix certain issues with self-joins and calculated attributes which is still necessary for Coursemology to function. The next step is to work on an alternative for that adapter.