mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-02 19:10:16 +01:00
Code style fixes
This commit is contained in:
parent
c6bbc67dab
commit
d8acf60049
72 changed files with 458 additions and 594 deletions
|
|
@ -1,5 +1,4 @@
|
|||
module Search
|
||||
|
||||
class SearchResults
|
||||
attr_reader :results
|
||||
|
||||
|
|
@ -27,28 +26,26 @@ module Search
|
|||
|
||||
def incomplete_todos(terms)
|
||||
@user.todos.
|
||||
where("(todos.description " + Common.like_operator + " ? OR todos.notes " + Common.like_operator + " ?) AND todos.completed_at IS NULL", terms, terms).
|
||||
includes(Todo::DEFAULT_INCLUDES).
|
||||
reorder(Arel.sql("todos.due IS NULL, todos.due ASC, todos.created_at ASC"))
|
||||
where("(todos.description " + Common.like_operator + " ? OR todos.notes " + Common.like_operator + " ?) AND todos.completed_at IS NULL", terms, terms)
|
||||
.includes(Todo::DEFAULT_INCLUDES)
|
||||
.reorder(Arel.sql("todos.due IS NULL, todos.due ASC, todos.created_at ASC"))
|
||||
end
|
||||
|
||||
def complete_todos(terms)
|
||||
@user.todos.
|
||||
where("(todos.description " + Common.like_operator + " ? OR todos.notes " + Common.like_operator + " ?) AND NOT (todos.completed_at IS NULL)", terms, terms).
|
||||
includes(Todo::DEFAULT_INCLUDES).
|
||||
reorder("todos.completed_at DESC")
|
||||
where("(todos.description " + Common.like_operator + " ? OR todos.notes " + Common.like_operator + " ?) AND NOT (todos.completed_at IS NULL)", terms, terms)
|
||||
.includes(Todo::DEFAULT_INCLUDES)
|
||||
.reorder("todos.completed_at DESC")
|
||||
end
|
||||
|
||||
def todo_tags_by_name(terms)
|
||||
Tagging.find_by_sql([
|
||||
"SELECT DISTINCT tags.name as name "+
|
||||
"FROM tags "+
|
||||
"LEFT JOIN taggings ON tags.id = taggings.tag_id "+
|
||||
"LEFT JOIN todos ON taggings.taggable_id = todos.id "+
|
||||
"WHERE todos.user_id=? "+
|
||||
"AND tags.name " + Common.like_operator + " ? ", @user.id, terms])
|
||||
"SELECT DISTINCT tags.name as name " +
|
||||
"FROM tags " +
|
||||
"LEFT JOIN taggings ON tags.id = taggings.tag_id " +
|
||||
"LEFT JOIN todos ON taggings.taggable_id = todos.id " +
|
||||
"WHERE todos.user_id=? " +
|
||||
"AND tags.name " + Common.like_operator + " ? ", @user.id, terms])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue