educode_sales 1.10.14 → 1.10.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -220,18 +220,10 @@ module EducodeSales
220
220
  s.department_business_count,
221
221
  s.major_count,
222
222
  s.department_id,
223
- departments.name AS department_name,
224
- t.teacher_count,
225
- t.student_count
223
+ departments.name AS department_name
226
224
  ").joins("
227
225
  JOIN schools ON s.id = schools.id
228
- LEFT JOIN departments ON s.department_id = departments.id
229
- LEFT JOIN (
230
- SELECT COUNT(IF(user_extensions.identity = 0, user_extensions.id, 0)) AS teacher_count,
231
- COUNT(IF(user_extensions.identity = 1, user_extensions.id, 1)) AS student_count, user_extensions.department_id
232
- FROM user_extensions
233
- GROUP BY user_extensions.department_id
234
- ) AS t ON t.department_id = s.department_id
226
+ LEFT JOIN departments ON schools.id = departments.school_id AND s.department_id = departments.id
235
227
  ")
236
228
 
237
229
  # part_a_ids = CustomerFollow.all.pluck(:school_id)
@@ -118,13 +118,17 @@ module EducodeSales
118
118
  if params[:q].present? && params[:q][:professional_title].present?
119
119
  @teachers = @teachers.where("educode_sales_teachers.professional_title = ?", "#{params[:q][:professional_title]}")
120
120
  end
121
+ # if params[:q].present? && params[:q][:regist_at].present?
122
+ # @teachers = @teachers.where("educode_sales_teachers.regist_at like ?", "%#{params[:q][:regist_at]}%")
123
+ # end
121
124
  if params[:q].present? && params[:q][:regist_at].present?
122
- @teachers = @teachers.where("educode_sales_teachers.regist_at like ?", "%#{params[:q][:regist_at]}%")
125
+ date = params[:q][:regist_at].split(" - ")
126
+ @teachers = @teachers.where("educode_sales_teachers.regist_at > ? AND educode_sales_teachers.regist_at < ?", date[0], date[1])
123
127
  end
124
128
  if params[:q].present? && params[:q][:status].present?
125
129
  if params[:q][:status] == "1"
126
130
  @teachers = @teachers.where("educode_sales_teachers.user_id is not null")
127
- else
131
+ else
128
132
  @teachers = @teachers.where("educode_sales_teachers.user_id is null")
129
133
  end
130
134
  end
@@ -2,6 +2,13 @@
2
2
  department_ids = @customers.map(&:department_id).uniq
3
3
  customer_ids = @customers.map(&:id).uniq
4
4
 
5
+ user_extensions = UserExtension.select(
6
+ "COUNT(IF(user_extensions.identity = 0, user_extensions.id, 0)) AS teacher_count,
7
+ COUNT(IF(user_extensions.identity = 1, user_extensions.id, 1)) AS student_count,
8
+ department_id"
9
+ ).where(department_id: department_ids).group("department_id").group_by(&:department_id)
10
+
11
+
5
12
  business_ids_group_a = EducodeSales::Business.where(department_id: department_ids).group_by(&:department_id)
6
13
  business_ids_group_b = EducodeSales::Business.where(school_id: customer_ids).group_by(&:school_id)
7
14
  all_follow_ups = EducodeSales::FollowUp.where(business_id: business_ids_group_a.values.flatten.map(&:id) + business_ids_group_b.values.flatten.map(&:id))
@@ -37,9 +44,13 @@ json.data do
37
44
  if d['department_id']
38
45
  json.business d['department_business_count'] || 0
39
46
  json.o_business o_business_count_group_a[d['department_id']] || 0
47
+ json.teacher_counts user_extensions[d['department_id']] && user_extensions[d['department_id']][0]['teacher_count'] || 0
48
+ json.student_counts user_extensions[d['department_id']] && user_extensions[d['department_id']][0]['student_count'] || 0
40
49
  else
41
50
  json.business d['school_business_count'] || 0
42
51
  json.o_business o_business_count_group_b[d.id] || 0
52
+ json.teacher_counts 0
53
+ json.student_counts 0
43
54
  end
44
55
  json.unit "#{d.name}---#{d['department_name']}"
45
56
 
@@ -48,8 +59,6 @@ json.data do
48
59
  json.department d['department_name'] || ''
49
60
  json.major_count d['major_count']
50
61
  json.department_id d['department_id'] || ''
51
- json.teacher_counts d['teacher_count'] || 0
52
- json.student_counts d['student_count'] || 0
53
62
  end
54
63
  end
55
64
 
@@ -13,7 +13,7 @@
13
13
  <div class="layui-input-block">
14
14
  <% d.each do |p| %>
15
15
  <% id += 1 %>
16
- <%= check_box_tag "permission[#{p.subject}][]", p.action, @permissions.include?(p.id), {title: p.name, id: "#{id}_" } %>
16
+ <%= check_box_tag "permission[#{p.subject}][]", p.action, @permissions.include?(p.id), {title: p.name, id: "#{id}_", "lay-skin": "tag" } %>
17
17
  <% end %>
18
18
  </div>
19
19
  </div>
@@ -79,7 +79,7 @@
79
79
  <div class="layui-input-block">
80
80
  <% d.each do |p| %>
81
81
  <% id += 1 %>
82
- <%= check_box_tag "permission[#{p.subject}][]", p.action, @permissions.include?(p.id), {title: p.name, id: "#{id}_" } %>
82
+ <%= check_box_tag "permission[#{p.subject}][]", p.action, @permissions.include?(p.id), {title: p.name, id: "#{id}_", "lay-skin": "tag"} %>
83
83
  <% end %>
84
84
  </div>
85
85
  </div>
@@ -150,11 +150,11 @@
150
150
  <script>
151
151
  layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate'], function () {
152
152
  var $ = layui.jquery,
153
- form = layui.form,
154
- request = layui.request,
155
- dropdown = layui.dropdown,
156
- miniPage = layui.miniPage,
157
- laydate = layui.laydate;
153
+ form = layui.form,
154
+ request = layui.request,
155
+ dropdown = layui.dropdown,
156
+ miniPage = layui.miniPage,
157
+ laydate = layui.laydate;
158
158
 
159
159
  var laydate = layui.laydate;
160
160
 
@@ -164,6 +164,7 @@
164
164
  });
165
165
  laydate.render({
166
166
  elem: '#time',
167
+ range: true
167
168
  });
168
169
 
169
170
  cols_table = [[
@@ -384,7 +385,7 @@
384
385
  },
385
386
  {
386
387
  title: '操作',
387
- minWidth: 170,
388
+ minWidth: 300,
388
389
  toolbar: '#currentTableBar',
389
390
  align: "center",
390
391
  fixed: 'right'
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '1.10.14'
2
+ VERSION = '1.10.15'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: educode_sales
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.14
4
+ version: 1.10.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-20 00:00:00.000000000 Z
11
+ date: 2023-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails