educode_sales 0.2.4 → 0.2.5
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.
- checksums.yaml +4 -4
- data/app/controllers/educode_sales/home_controller.rb +3 -2
- data/app/controllers/educode_sales/teachers_controller.rb +10 -4
- data/app/helpers/educode_sales/application_helper.rb +12 -0
- data/app/models/educode_sales/teacher.rb +2 -2
- data/app/views/educode_sales/activities/show_teachers.html.erb +4 -3
- data/app/views/educode_sales/teachers/index.html.erb +1 -1
- data/app/views/educode_sales/teachers/index.json.jbuilder +3 -4
- data/app/views/educode_sales/teachers/show_class.html.erb +2 -2
- data/lib/educode_sales/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 384aa48b4fd48766ddfc7db4adcf12f640b9adbf
|
4
|
+
data.tar.gz: 7761bc4921a22238d59836aa55c08ee27f3387f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b71058d21d50127f1bf6526ecdd4c3b843fe426d3988f0289c101979bda12df16980aceae09f3b344458c089bc4bc840a384a4f540388c8bfa5ed1742cf191f4
|
7
|
+
data.tar.gz: 234eb2e4fccc311cc35d88d2da52366364cce6bead12233ab83e856943f744599772650555e76389d53a57e86479ebbde7a64882a23c46bec1436fd1984e4e8c
|
@@ -17,9 +17,10 @@ module EducodeSales
|
|
17
17
|
|
18
18
|
def search
|
19
19
|
if params[:type] == 'department'
|
20
|
-
|
20
|
+
|
21
|
+
@data = Department.joins(:school).where("schools.name like :q", q: "%#{params[:q]}%").limit(20)
|
21
22
|
unless @data.present?
|
22
|
-
@data = Department.
|
23
|
+
@data = Department.where("name like ?", "%#{params[:q]}%").limit(20)
|
23
24
|
end
|
24
25
|
elsif params[:type] == "school"
|
25
26
|
data = School.where("name like ? ", "%#{params[:q]}%").limit(20)
|
@@ -101,9 +101,9 @@ module EducodeSales
|
|
101
101
|
# 把老师添加到活动列表,提取判断下老师列表是否存在
|
102
102
|
find_teacher = Teacher.find_by(user_id: params[:user_id])
|
103
103
|
if find_teacher
|
104
|
-
find_teacher.activity_teachers.build(activity_id: params[:activity_id])
|
105
104
|
teacher = find_teacher
|
106
105
|
end
|
106
|
+
teacher.activity_teachers.build(activity_id: params[:activity_id])
|
107
107
|
end
|
108
108
|
|
109
109
|
if teacher.save
|
@@ -130,8 +130,14 @@ module EducodeSales
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def destroy
|
133
|
-
|
134
|
-
|
133
|
+
if params[:activity_id].present?
|
134
|
+
activity_teacher = ActivityTeacher.find_by(activity_id: params[:activity_id], teacher_id: params[:id])
|
135
|
+
activity_teacher.destroy
|
136
|
+
else
|
137
|
+
teacher = Teacher.find(params[:id])
|
138
|
+
teacher.destroy
|
139
|
+
end
|
140
|
+
|
135
141
|
render_success
|
136
142
|
end
|
137
143
|
|
@@ -245,7 +251,7 @@ module EducodeSales
|
|
245
251
|
def course_list
|
246
252
|
user = User.find_by(id: params[:user_id])
|
247
253
|
if user
|
248
|
-
@courses = Course.joins(:course_members).where(course_members: {user_id: user.id}).page(params[:page]).per(params[:limit])
|
254
|
+
@courses = Course.joins(:course_members).where(course_members: {user_id: user.id}).distinct("course_id").page(params[:page]).per(params[:limit])
|
249
255
|
else
|
250
256
|
@courses = Course.none
|
251
257
|
end
|
@@ -40,5 +40,17 @@ module EducodeSales
|
|
40
40
|
def relative_path
|
41
41
|
"avatars"
|
42
42
|
end
|
43
|
+
|
44
|
+
def base_url
|
45
|
+
url = Rails.application.config_for(:configuration)['wechat_pay']['callback_url']
|
46
|
+
if url.include?("https://data.educoder")
|
47
|
+
"https://www.educoder.net"
|
48
|
+
elsif url.include?("'https://pre-data.educoder")
|
49
|
+
"https://pre.educoder.net"
|
50
|
+
else
|
51
|
+
"https://test.educoder.net"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
43
55
|
end
|
44
56
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module EducodeSales
|
2
2
|
class Teacher < ApplicationRecord
|
3
|
-
has_many :activity_teachers
|
3
|
+
has_many :activity_teachers, dependent: :destroy
|
4
4
|
has_many :activities, through: :activity_teachers
|
5
5
|
has_many :teacher_follows, dependent: :destroy
|
6
6
|
has_many :operation_plans, dependent: :destroy
|
@@ -19,7 +19,7 @@ module EducodeSales
|
|
19
19
|
user_ids = User.joins(:user_extension).where(user_extensions: {department_id: self.department_id, identity: 0}).pluck(:id)
|
20
20
|
course_ids = CourseMember.where(role: "CREATOR", user_id: user_ids).pluck(:course_id)
|
21
21
|
if course_ids.present?
|
22
|
-
course_members = CourseMember.joins(course: :practice_homework_shixuns).where(course_id: course_ids).group("course_id").having("COUNT(homework_commons_shixuns.id) > 100 AND COUNT(course_members.user_id) >
|
22
|
+
course_members = CourseMember.joins(course: :practice_homework_shixuns).where(course_id: course_ids).group("course_id").having("COUNT(homework_commons_shixuns.id) > 100 AND COUNT(course_members.user_id) > 20").select("COUNT(case when course_members.role !=4 then 1 END) AS count")
|
23
23
|
course_members.present? ? course_members[0]['count'] : 0
|
24
24
|
else
|
25
25
|
0
|
@@ -245,9 +245,10 @@
|
|
245
245
|
} else if (obj.event === 'delete') {
|
246
246
|
console.log(data);
|
247
247
|
layer.confirm('确定删除' + data.name, function (index) {
|
248
|
-
request.delete('educode_sales/teachers/' + data.id, {}, function (res) {
|
249
|
-
|
250
|
-
|
248
|
+
request.delete('educode_sales/teachers/' + data.id, {activity_id: activity_id}, function (res) {
|
249
|
+
layer.close(index);
|
250
|
+
table.reload("activities_table")
|
251
|
+
table.reload("show_teachers_table")
|
251
252
|
})
|
252
253
|
});
|
253
254
|
} else if (obj.event === 'addWeek') {
|
@@ -88,7 +88,7 @@
|
|
88
88
|
</script>
|
89
89
|
<script type="text/html" id="name">
|
90
90
|
{{# if (d.login) { }}
|
91
|
-
<a href="
|
91
|
+
<a href="<%= base_url%>/users/{{d.login}}" class="layui-table-link" target="_blank">{{ d.name }}</a>
|
92
92
|
{{# } else {}}
|
93
93
|
<a href="javascript:;" class="">{{ d.name }}</a>
|
94
94
|
{{# }}}
|
@@ -14,13 +14,12 @@ json.data do
|
|
14
14
|
json.source EducodeSales::Common.teacher_source_name[d.source_id]
|
15
15
|
# a_id = EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).present? ? EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).attitude_id : 73
|
16
16
|
json.attitude EducodeSales::TeacherFollow.find_by(teacher_id: d.id).present? ? EducodeSales::Common.find(EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).attitude_id).name : ''
|
17
|
-
json.courses_count d.user_id ? Course.joins(:course_members).where(course_members: {user_id: d.user_id}).count : 0
|
17
|
+
json.courses_count d.user_id ? Course.joins(:course_members).where(course_members: {user_id: d.user_id}).distinct("course_id").count : 0
|
18
18
|
json.actives d.actives
|
19
19
|
json.students d.students_count
|
20
|
-
json.regist_at d.regist_at ? d.regist_at.to_s(:date) : ''
|
20
|
+
json.regist_at d.regist_at && d.user_id ? d.regist_at.to_s(:date) : ''
|
21
21
|
json.teacher_used d.teacher_used_of_department
|
22
22
|
end
|
23
23
|
end
|
24
24
|
json.code 0
|
25
|
-
json.count @teachers.total_count
|
26
|
-
json.msg 'succcess'
|
25
|
+
json.count @teachers.total_count
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
<script type="text/html" id="class_name">
|
3
|
-
<a href="
|
3
|
+
<a href="<%= base_url %>/classrooms/{{d.id}}" class="layui-table-link" target="_blank">{{ d.name }}</a>
|
4
4
|
</script>
|
5
5
|
|
6
6
|
<table class="layui-hide" id="class_T" lay-filter="classFilter"></table>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
{
|
24
24
|
field: 'name',
|
25
25
|
width: 150,
|
26
|
-
title: '
|
26
|
+
title: '课堂名称',
|
27
27
|
templet: "#class_name"
|
28
28
|
|
29
29
|
},
|
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: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|