From 8843b1335c7211f3111d7fd6e11784f8e866b799 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 4 Sep 2019 18:16:58 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/files/_tool_settings.html.erb | 38 ++++++++++++-------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb
index 4ebbf852..577030f8 100644
--- a/app/views/files/_tool_settings.html.erb
+++ b/app/views/files/_tool_settings.html.erb
@@ -5,16 +5,16 @@
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
- <% if hidden_unproject_infos %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <% else %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
- <% end %>
- <% if params[:tag_name].blank? %>
- - <%= link_to '更新版本',attachments_versions_path(file, :project_id => project.id), :class => "postOptionLink", :remote => true %>
- <% else %>
- - <%= link_to '更新版本',attachments_versions_path(file, :tag_name => params[:tag_name].force_encoding("UTF-8"), :project_id => project.id, :other => params[:other]),:class => "postOptionLink",:remote=>true %>
- <% end %>
+ <%# if hidden_unproject_infos %>
+
+ <%# else %>
+
+ <%# end %>
+ <%# if params[:tag_name].blank? %>
+
+ <%# else %>
+
+ <%# end %>
<% if project.is_public? %>
-
@@ -38,15 +38,15 @@
<% end %>
<% else %>
-
-
- <% if hidden_unproject_infos %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <% else %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
- <% end %>
-
-
+
+
+ <%# if hidden_unproject_infos %>
+
+ <%# else %>
+
+ <%# end %>
+
+
<% end %>
<% end %>
From 5686d81ca9d640345a0fa3ce4634e8225d51145f Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 5 Sep 2019 21:37:42 +0800
Subject: [PATCH 02/10] tiaoz
---
app/models/message.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/models/message.rb b/app/models/message.rb
index 9e516acb..91fdefac 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -119,6 +119,10 @@ class Message < ActiveRecord::Base
message_detail.try(:content)
end
+ def content
+ message_detail.try(:content)
+ end
+
# def content
# self.try(:content)
# end
From 6e322a563078a965cc42cb84fbcf3d04a1b576eb Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 6 Sep 2019 09:34:06 +0800
Subject: [PATCH 03/10] =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=AE=A1=E6=89=B9?=
=?UTF-8?q?=E6=8A=A5500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index e4a51b26..c1cf4771 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1756,8 +1756,10 @@ end
Tiding.where(:user_id => 1, :trigger_user_id => applied_department.user_id, :container_id => applied_department.id, :container_type => 'ApplyAddDepartment', :status => 0, :tiding_type => "Apply").update_all(:status => 1)
Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason])
# 删除学校的用户
- users = UserExtensions.where("department_id = #{applied_department.department_id}")
- users.update_all(department_id: nil, profile_completed: false)
+ user_exs = UserExtensions.where("department_id = #{applied_department.department_id}")
+ users = User.where(id: user_exs.pluck(:user_id))
+ user_exs.update_all(department_id: nil)
+ users.update_all(profile_completed: false)
applied_department.department.destroy
# 已审批删除
elsif params[:tip] == "applied"
From 7da238def9c71456595c5147d130ff0544764f78 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 6 Sep 2019 10:13:52 +0800
Subject: [PATCH 04/10] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=9A=84=E5=88=A0?=
=?UTF-8?q?=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 38 ++++++++++---------
...0190906014148_migrate_delete_department.rb | 16 ++++++++
2 files changed, 36 insertions(+), 18 deletions(-)
create mode 100644 db/migrate/20190906014148_migrate_delete_department.rb
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index c1cf4771..96dea860 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1746,24 +1746,26 @@ end
# 删除
def delete_applied_departments
- applied_department = ApplyAddDepartment.find params[:depart_id]
- applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
- applied_message.update_all(:status => 3)
- applied_department.update_attribute(:status, 3)
- # 未审批删除
- if params[:tip] == "unapplied"
- # AppliedMessage.create(:user_id => applied_department.user_id, :status => 3, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name )
- Tiding.where(:user_id => 1, :trigger_user_id => applied_department.user_id, :container_id => applied_department.id, :container_type => 'ApplyAddDepartment', :status => 0, :tiding_type => "Apply").update_all(:status => 1)
- Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason])
- # 删除学校的用户
- user_exs = UserExtensions.where("department_id = #{applied_department.department_id}")
- users = User.where(id: user_exs.pluck(:user_id))
- user_exs.update_all(department_id: nil)
- users.update_all(profile_completed: false)
- applied_department.department.destroy
- # 已审批删除
- elsif params[:tip] == "applied"
- applied_department.destroy
+ transaction do
+ applied_department = ApplyAddDepartment.find params[:depart_id]
+ applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
+ applied_message.update_all(:status => 3)
+ applied_department.update_attribute(:status, 3)
+ # 未审批删除
+ if params[:tip] == "unapplied"
+ # AppliedMessage.create(:user_id => applied_department.user_id, :status => 3, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name )
+ Tiding.where(:user_id => 1, :trigger_user_id => applied_department.user_id, :container_id => applied_department.id, :container_type => 'ApplyAddDepartment', :status => 0, :tiding_type => "Apply").update_all(:status => 1)
+ Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason])
+ # 删除学校的用户
+ user_exs = UserExtensions.where("department_id = #{applied_department.department_id}")
+ users = User.where(id: user_exs.pluck(:user_id))
+ user_exs.update_all(department_id: nil)
+ users.update_all(profile_completed: false)
+ applied_department.department.destroy
+ # 已审批删除
+ elsif params[:tip] == "applied"
+ applied_department.destroy
+ end
end
respond_to do |format|
format.html{ redirect_to depart_managements_path }
diff --git a/db/migrate/20190906014148_migrate_delete_department.rb b/db/migrate/20190906014148_migrate_delete_department.rb
new file mode 100644
index 00000000..32a84b44
--- /dev/null
+++ b/db/migrate/20190906014148_migrate_delete_department.rb
@@ -0,0 +1,16 @@
+class MigrateDeleteDepartment < ActiveRecord::Migration
+ def up
+ ApplyAddDepartment.where("status= 3 and created_at > '2019-07-25 00:00:00'").each do |apply|
+ if apply.department.present? && !apply.department.is_auth
+ user_exs = UserExtensions.where("department_id = #{apply.department_id}")
+ users = User.where(id: user_exs.pluck(:user_id))
+ user_exs.update_all(department_id: nil)
+ users.update_all(profile_completed: false)
+ apply.department.destroy
+ end
+ end
+ end
+
+ def down
+ end
+end
From 71a0e539053713a9a23628e7d3107265b4a355aa Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 9 Sep 2019 09:22:08 +0800
Subject: [PATCH 05/10] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AD=A6=E7=94=9F?=
=?UTF-8?q?=E6=97=B6=E5=88=9B=E5=BB=BA=E4=BD=9C=E5=93=81=E5=81=9A=E5=94=AF?=
=?UTF-8?q?=E4=B8=80=E6=80=A7=E5=88=A4=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/course_member.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/models/course_member.rb b/app/models/course_member.rb
index d67994ef..788f87aa 100644
--- a/app/models/course_member.rb
+++ b/app/models/course_member.rb
@@ -15,6 +15,7 @@ class CourseMember < ActiveRecord::Base
homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_type in (1, 3, 4)")
if homeworks.count != 0
homeworks.each do |hw|
+ next if hw.student_works.where(user_id: user_id).any?
str += "," if str != ""
str += "('#{hw.name}的作品提交',#{hw.id},#{user_id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
@@ -34,6 +35,7 @@ class CourseMember < ActiveRecord::Base
exercises = course.exercises
if exercises.count != 0
exercises.each do |ex|
+ next if ex.exercise_users.where(user_id: user_id).any?
str += "," if str != ""
str += "(#{ex.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
@@ -53,6 +55,7 @@ class CourseMember < ActiveRecord::Base
polls = course.polls
if polls.count != 0
polls.each do |poll|
+ next if poll.poll_users.where(user_id: user_id).any?
str += "," if str != ""
str += "(#{poll.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
@@ -72,6 +75,7 @@ class CourseMember < ActiveRecord::Base
tasks = course.graduation_tasks
if tasks.count != 0
tasks.each do |task|
+ next if task.graduation_works.where(user_id: user_id).any?
str += "," if str != ""
str += "(#{task.id}, #{user_id}, #{course.id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end
From 7a5499a62229078020da5c6e068caa6c836790d0 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 10 Sep 2019 09:30:04 +0800
Subject: [PATCH 06/10] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=88=90=E7=BB=A9?=
=?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=8C=87=E5=AF=BC=E8=80=81=E5=B8=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/competition_team.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb
index e2551710..7b0e6d50 100644
--- a/app/models/competition_team.rb
+++ b/app/models/competition_team.rb
@@ -11,7 +11,8 @@ class CompetitionTeam < ActiveRecord::Base
# attr_accessible :invite_code, :name, :team_type
def teacher
- User.where(:id => self.teacher_id).first
+ teacher_id = self.teachers.first&.user_id
+ User.find_by(id: teacher_id)
end
def group_members
From 78f1d0610f4ea89cce068d71f7eabe45d583584a Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 10 Sep 2019 09:34:38 +0800
Subject: [PATCH 07/10] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=AB=9E=E8=B5=9B?=
=?UTF-8?q?=E6=88=90=E7=BB=A9=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/competition_team.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb
index 7b0e6d50..a8f48b3e 100644
--- a/app/models/competition_team.rb
+++ b/app/models/competition_team.rb
@@ -12,7 +12,7 @@ class CompetitionTeam < ActiveRecord::Base
def teacher
teacher_id = self.teachers.first&.user_id
- User.find_by(id: teacher_id)
+ User.where(id: teacher_id).first
end
def group_members
From a5298562748aeef63cab8b1a04f2e8339a8fe624 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 18 Sep 2019 17:24:41 +0800
Subject: [PATCH 08/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E6=8A=A5500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 96dea860..b766ad07 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1746,7 +1746,7 @@ end
# 删除
def delete_applied_departments
- transaction do
+ ActiveRecord::Base.transaction do
applied_department = ApplyAddDepartment.find params[:depart_id]
applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
applied_message.update_all(:status => 3)
From 7bb5548fe0dbcedbeccfde35401e6de5d6175c01 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 19 Sep 2019 17:52:06 +0800
Subject: [PATCH 09/10] =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E8=AE=A4=E8=AF=81?=
=?UTF-8?q?=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/ec_major_schools_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/ec_major_schools_helper.rb b/app/helpers/ec_major_schools_helper.rb
index 512e1cef..ad104676 100644
--- a/app/helpers/ec_major_schools_helper.rb
+++ b/app/helpers/ec_major_schools_helper.rb
@@ -11,7 +11,7 @@ module EcMajorSchoolsHelper
relations = EcGraduationRequirementCalculation.joins(ec_course_support: :ec_graduation_subitem_courses).where('ec_graduation_subitem_id in (?)', subitem_ids)
- reached_map = relations.where(status: true).group('ec_graduation_subitem_id').count
+ reached_map = relations.where(status: true).group('ec_graduation_subitem_courses.ec_graduation_subitem_id').count
reached_map.keys.size
end
From d86607d1b3b29298e8480628780648cd7dee2835 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 19 Sep 2019 17:53:52 +0800
Subject: [PATCH 10/10] =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E8=AE=A4=E8=AF=81500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/ec_major_schools_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/ec_major_schools_helper.rb b/app/helpers/ec_major_schools_helper.rb
index ad104676..d4e34219 100644
--- a/app/helpers/ec_major_schools_helper.rb
+++ b/app/helpers/ec_major_schools_helper.rb
@@ -9,7 +9,7 @@ module EcMajorSchoolsHelper
subitem_ids = ec_year.ec_graduation_subitems.reorder(nil).pluck(:id)
- relations = EcGraduationRequirementCalculation.joins(ec_course_support: :ec_graduation_subitem_courses).where('ec_graduation_subitem_id in (?)', subitem_ids)
+ relations = EcGraduationRequirementCalculation.joins(ec_course_support: :ec_graduation_subitem_courses).where('ec_graduation_subitem_courses.ec_graduation_subitem_id in (?)', subitem_ids)
reached_map = relations.where(status: true).group('ec_graduation_subitem_courses.ec_graduation_subitem_id').count