educode_sales 1.10.35 → 1.10.37
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b46b08f02fd4495dc7dcbe644409b09c38fd9936ce81c574d8747eadeb935dab
|
4
|
+
data.tar.gz: 874c54125a516d0631812e60fb439418cf050550dfd40166777762d4e6b48221
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e3f554a6a434861cc05e461b6a7c9b9af265917f2fce21cc947fcf51d206de976fe8d7abe7f2684eaa075cc8f045d601535885dd0b64dbf61db7d9ae1552a8a
|
7
|
+
data.tar.gz: aa3c405230daa0c34902d42a4d6e3fabfeea3b7c6be4611a4535a5dbdcf57f1921e906da9397e7fc3c1d6e0ef60985ef3bc39e632c2f0f190ef703d93c54413e
|
@@ -54,15 +54,15 @@ module EducodeSales
|
|
54
54
|
level = @current_admin.role.role_areas.find_by(clazz: '方案管理').try(:level)
|
55
55
|
case level
|
56
56
|
when '自己'
|
57
|
-
idea_ids =
|
58
|
-
@ideas =
|
57
|
+
idea_ids = @ideas.select { |d| Array(d.other_staff_ids).include?(@current_admin.id) || d.sale_staff_id == @current_admin.id || Array(d.assist_staff_ids).include?(@current_admin.id) || d.staff_id == @current_admin.id }.map { |d| d.id }
|
58
|
+
@ideas = @ideas.where("educode_sales_ideas.creator_id = ? OR educode_sales_ideas.id in (?)", @current_admin.id, idea_ids)
|
59
59
|
when '区域'
|
60
60
|
# 查看区域商机,需要排除掉其它人员手上的监管学校
|
61
61
|
other_staff_school_id = EducodeSales::StaffSchool.where.not(staff_id: @current_admin.id).where("school_id IN (SELECT school_id FROM educode_sales_staff_schools WHERE staff_id = #{@current_admin.id}) IS NOT TRUE").distinct.pluck :school_id
|
62
62
|
|
63
63
|
school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id) - other_staff_school_id
|
64
|
-
idea_ids =
|
65
|
-
@ideas = @ideas.
|
64
|
+
idea_ids = @ideas.select { |d| Array(d.other_staff_ids).include?(@current_admin.id) || d.sale_staff_id == @current_admin.id || Array(d.assist_staff_ids).include?(@current_admin.id) || d.staff_id == @current_admin.id }.map { |d| d.id }
|
65
|
+
@ideas = @ideas.left_joins(department: :school).where("schools.id in (?) OR educode_sales_ideas.creator_id = ? OR educode_sales_ideas.id in (?)", school_ids, @current_admin.id, idea_ids)
|
66
66
|
else
|
67
67
|
@ideas = @ideas
|
68
68
|
end
|