Skip to content
代码片段 群组 项目
提交 14b2079b 编辑于 作者: Marco Zille's avatar Marco Zille
浏览文件

Fixed rubocop errors

上级 8718e514
No related branches found
No related tags found
无相关合并请求
...@@ -25,7 +25,7 @@ def execute ...@@ -25,7 +25,7 @@ def execute
contacts = root_group.contacts contacts = root_group.contacts
contacts = by_state(contacts) contacts = by_state(contacts)
contacts = by_search(contacts) contacts = by_search(contacts)
contacts.sort_by_name() contacts.sort_by_name
end end
private private
......
...@@ -25,7 +25,7 @@ def execute ...@@ -25,7 +25,7 @@ def execute
organizations = root_group.organizations organizations = root_group.organizations
organizations = by_search(organizations) organizations = by_search(organizations)
organizations = by_state(organizations) organizations = by_state(organizations)
organizations.sort_by_name() organizations.sort_by_name
end end
private private
...@@ -42,7 +42,6 @@ def root_group ...@@ -42,7 +42,6 @@ def root_group
def by_search(organizations) def by_search(organizations)
return organizations unless search? return organizations unless search?
return organizations.none if params[:search].blank?
organizations.search(params[:search]) organizations.search(params[:search])
end end
...@@ -50,7 +49,7 @@ def by_search(organizations) ...@@ -50,7 +49,7 @@ def by_search(organizations)
def by_state(organizations) def by_state(organizations)
return organizations unless state? return organizations unless state?
organizations.where(state: params[:state]) organizations.search_by_state(params[:state])
end end
def search? def search?
......
...@@ -56,7 +56,7 @@ def self.search_by_state(state) ...@@ -56,7 +56,7 @@ def self.search_by_state(state)
where(state: state) where(state: state)
end end
def self.sort_by_name() def self.sort_by_name
order("first_name ASC, last_name ASC") order("first_name ASC, last_name ASC")
end end
......
...@@ -34,7 +34,11 @@ def self.search(query) ...@@ -34,7 +34,11 @@ def self.search(query)
fuzzy_search(query, [:name], use_minimum_char_limit: false) fuzzy_search(query, [:name], use_minimum_char_limit: false)
end end
def self.sort_by_name() def self.search_by_state(state)
where(state: state)
end
def self.sort_by_name
order(name: :asc) order(name: :asc)
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册