From 29680bd7ad47dca57d69847539efca960104d4e0 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 19 Jul 2019 18:07:43 +0800 Subject: [PATCH 01/11] sync new git --- lib/tasks/gitlab_new.rake | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/tasks/gitlab_new.rake diff --git a/lib/tasks/gitlab_new.rake b/lib/tasks/gitlab_new.rake new file mode 100644 index 00000000..fd6e0c56 --- /dev/null +++ b/lib/tasks/gitlab_new.rake @@ -0,0 +1,31 @@ +namespace :gitlab do + task :myshixun_newgit => :environment do + g = Gitlab.client + myshixuns = Myshixun.where("repo_name is null") + myshixuns.find_each do |myshixun| + begin + puts myshixun.id + repo_name = g.project(myshixun.gpid).path_with_namespace + puts repo_name + myshixun.update_column(:repo_name, repo_name) + rescue Exception => e + Rails.logger.error("e.message") + end + end + end + + task :shixun_newgit => :environment do + g = Gitlab.client + shixuns = Shixun.where("repo_name is null") + shixuns.find_each do |shixun| + begin + puts shixun.id + repo_name = g.project(shixun.gpid).path_with_namespace + puts shixun.id + shixun.update_column(:repo_name, repo_name) + rescue Exception => e + Rails.logger.error("e.message") + end + end + end +end From 457546c804df3408f8429c7620c11ab60b67b4a8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 19 Jul 2019 19:06:56 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/update.html b/public/update.html index e609e7aa..18c1c436 100644 --- a/public/update.html +++ b/public/update.html @@ -56,7 +56,7 @@ If you continue to experience problems please contact your Trustie administrator 温馨提示:为了给大家提供更优质的服务

- 平台拟于2019年4月27日17:00--18:30进行全面升级,带来不便,敬请谅解! + 平台拟于2019年7月19日21:30--2019年7月20号12:00进行全面升级,带来不便,敬请谅解!

From d9590c1196d492c78176890873ae820e625b0b23 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 19 Jul 2019 21:31:12 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/update.html b/public/update.html index 18c1c436..f02cd46b 100644 --- a/public/update.html +++ b/public/update.html @@ -51,7 +51,7 @@ If you continue to experience problems please contact your Trustie administrator

If you are the Trustie administrator, check your log files for details about the error.

-->
- +

温馨提示:为了给大家提供更优质的服务

From 727ed3781c10ce74819601cffbcb5026161a068e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 20 Jul 2019 01:44:21 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/update.html b/public/update.html index f02cd46b..f255ad3e 100644 --- a/public/update.html +++ b/public/update.html @@ -56,7 +56,7 @@ If you continue to experience problems please contact your Trustie administrator 温馨提示:为了给大家提供更优质的服务

- 平台拟于2019年7月19日21:30--2019年7月20号12:00进行全面升级,带来不便,敬请谅解! + 平台拟于2019年7月19日21:30--2019年7月20号16:00进行全面升级,带来不便,敬请谅解!

From dda58619fcf378da58108615c0edd1b2c355d4dd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 20 Jul 2019 15:56:32 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/update.html b/public/update.html index f255ad3e..8c5264fe 100644 --- a/public/update.html +++ b/public/update.html @@ -56,7 +56,7 @@ If you continue to experience problems please contact your Trustie administrator 温馨提示:为了给大家提供更优质的服务

- 平台拟于2019年7月19日21:30--2019年7月20号16:00进行全面升级,带来不便,敬请谅解! + 平台拟于2019年7月19日21:30--2019年7月20号20:00进行全面升级,带来不便,敬请谅解!

From f7d4d0a38c310b30d7504b2211d7cc37e6bda7c5 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 20 Jul 2019 16:09:43 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E8=80=81=E7=89=88=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 4 +- .../competition_teams_controller.rb | 5 +- app/controllers/courses_controller.rb | 4 +- app/controllers/managements_controller.rb | 16 ++--- app/controllers/users_controller.rb | 6 +- app/models/course.rb | 10 ++- app/models/course_group.rb | 1 + app/models/course_member.rb | 7 ++ app/models/message.rb | 5 +- app/models/message_detail.rb | 4 ++ app/models/user.rb | 4 +- app/services/users_service.rb | 4 +- .../_classroom_classment_list.html.erb | 2 +- .../managements/_course_message_list.html.erb | 2 +- .../managements/_shixun_task_list.html.erb | 2 +- app/views/users/show.html.erb | 68 ++++++++++--------- spec/factories/course_members.rb | 5 ++ spec/factories/message_details.rb | 5 ++ spec/models/course_member_spec.rb | 5 ++ spec/models/message_detail_spec.rb | 5 ++ 20 files changed, 103 insertions(+), 61 deletions(-) create mode 100644 app/models/course_member.rb create mode 100644 app/models/message_detail.rb create mode 100644 spec/factories/course_members.rb create mode 100644 spec/factories/message_details.rb create mode 100644 spec/models/course_member_spec.rb create mode 100644 spec/models/message_detail_spec.rb diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index 4bc6cd87..15f9ef8f 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -67,12 +67,12 @@ class CollegesController < ApplicationController user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count) @teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count, - (SELECT count(c.id) FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) and c.school_id = #{@school.id} AND m.user_id=users.id AND c.is_delete = 0) as course_count + (SELECT count(c.id) FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) and c.school_id = #{@school.id} AND m.user_id=users.id AND c.is_delete = 0) as course_count FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10") # ).order("publish_shixun_count desc, experience desc").limit(10) @teachers = @teachers.map do |teacher| - course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE c.id != 1309 and m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{@school.id}") + course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{@school.id}") course_count = course_ids.size homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id)) un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index c285fba7..2bbbd6ef 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -32,9 +32,8 @@ class CompetitionTeamsController < ApplicationController # todo:使用新版course_members course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) - .joins('join members on members.course_id = courses.id') - .joins('join member_roles on member_roles.member_id = members.id and member_roles.role_id in (3,7,9)') - .where(members: { user_id: @team_user_ids }).pluck(:id) + .joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)') + .where(course_members: { user_id: @team_user_ids }).pluck(:id) courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()') @courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count') .group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0') diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index b830776b..19bf3039 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -87,7 +87,7 @@ class CoursesController < ApplicationController course_ids = course_ids.present? ? course_ids.join(",") : -1 @courses = Course.where("courses.is_delete = 0 and courses.is_hidden = 0 #{course_ids == -1 ? "" : "and courses.id in (#{course_ids})"}").select("courses.id, courses.tea_id, courses.name, courses.is_public, courses.members_count, courses.homework_commons_count,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("courses.id = 1309 desc, a desc") elsif @order == "mine" - my_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9,10) AND m.user_id=#{@user.id} AND c.is_delete = 0") + my_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3,4) AND m.user_id=#{@user.id} AND c.is_delete = 0") course_ids = course_ids.present? ? my_course_ids.map(&:id) & course_ids : my_course_ids.map(&:id) course_ids = course_ids.size > 0 ? course_ids.join(",") : "-1" @courses = Course.find_by_sql("select c.id, c.tea_id, c.name, c.is_public, c.members_count, c.homework_commons_count, u.login, u.nickname, u.lastname, u.firstname, u.show_realname, ue.school_id from courses c, users u, user_extensions ue where c.tea_id = u.id and u.id = ue.user_id and c.is_delete = 0 and c.is_hidden = 0 and c.id in (#{course_ids}) order by c.id = 1309 desc, #{order_str} desc") @@ -894,7 +894,7 @@ class CoursesController < ApplicationController # @teacher_count = TeacherAndAssistantCount @course if @course.try(:id) != 1309 || User.current.admin? || User.current.try(:id) == 15582 - @teacher_count = @course.members.includes(:roles, :user).where("roles.id" => [3,7,9]).count + @teacher_count = @course.course_members.includes(:roles, :user).where("roles.id" => [3,7,9]).count else @teacher_count = @course.members.includes(:roles, :user).where("roles.id" => [3,7]).count end diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 156ae951..730f991c 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2944,20 +2944,20 @@ end course_group = CourseGroup.where(:course_id => course.id, :name => group_name).first || CourseGroup.create(:name => group_name, :course_id => course.id) if group_name - member = course.members.where(:user_id => user.id).first + member = course.course_members.where(:user_id => user.id, :role => 4).first # 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班 - if member.present? && member.member_roles.pluck(:role_id).include?(10) && member.course_group_id != course_group.try(:id).to_i + if member.present? && member.course_group_id != course_group.try(:id).to_i member.update_column("course_group_id", course_group.try(:id).to_i) member_count += 1 elsif !member.present? - member = Member.new(:role_ids => [member_role], :user_id => user.id) - if member_role == 10 - StudentsForCourse.create(:student_id => user.id, :course_id => course.id) - end + member = CourseMember.new(:role => 4, :user_id => user.id) + # if member_role == 10 + # StudentsForCourse.create(:student_id => user.id, :course_id => course.id) + # end Tiding.create(:user_id => user.id, :trigger_user_id => course.tea_id, :container_id => course.id, :container_type => 'TeacherJoinCourse', :belong_container_id => course.id, :belong_container_type => "Course", :tiding_type => "System", :extra => member_role) member.course_group_id = course_group.try(:id).to_i - course.members << member + course.course_members << member member_count += 1 end @@ -4262,7 +4262,7 @@ end teacher_name = course.teacher ? course.teacher.show_real_name : "" sheet1[count_row,0] = course.id sheet1[count_row,1] = course.name - sheet1[count_row,2] = course.members.count + sheet1[count_row,2] = course.course_members_count sheet1[count_row,3] = course.attachments.count sheet1[count_row,4] = course.homework_commons.where(:homework_type => 1).count sheet1[count_row,5] = course.homework_commons.where(:homework_type => 4).count diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 744b1d1f..3fd3759a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2438,14 +2438,14 @@ class UsersController < ApplicationController case @type when "a_course" student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, students_for_courses sfc WHERE sfc.course_id = c.id AND sfc.student_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}") - manage_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}") + manage_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}") course_ids = student_course_ids.map(&:id) + manage_course_ids.map(&:id) @objects = Course.where(:id => course_ids.uniq).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("updated_at #{order}") when "l_course" - student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, students_for_courses sfc WHERE sfc.course_id = c.id AND sfc.student_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}") + student_course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id and m.role = 4 AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}") @objects = Course.where(:id => student_course_ids.map(&:id)).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("updated_at #{order}") when "p_course" - course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}") + course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{@user.id} AND c.is_delete = 0 AND c.is_end in #{status}") @objects = Course.where(:id => course_ids.map(&:id)).includes(:attachments, :teacher => [:user_extensions => [:school]]).order("id = 1309 desc, updated_at #{order}") when "a_shixun" shixun_ids = @user.shixun_members.map(&:shixun_id) + @user.myshixuns.map(&:shixun_id) diff --git a/app/models/course.rb b/app/models/course.rb index c6c6d3df..5068e38e 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -33,6 +33,8 @@ class Course < ActiveRecord::Base belongs_to :syllabus belongs_to :course_list # has_many :bid + has_many :course_members, dependent: :destroy + has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}" has_many :memberships, :class_name => 'Member' has_many :member_principals, :class_name => 'Member', @@ -290,12 +292,16 @@ class Course < ActiveRecord::Base # 课堂的老师不包括助教 def course_teachers - self.members.select{|m| m.roles.to_s.include?("Manager") || m.roles.to_s.include?("Teacher")} + self.course_members.where(:role => [1, 2]) end # 课堂的老师包括助教 def teachers - self.members.includes(:roles).where("roles.id" => [3,7,9]) + self.course_members.where(:role => [1, 2, 3]) + end + + def students + self.course_members.where(:role => [4]) end def self.visible_condition(user, options={}) diff --git a/app/models/course_group.rb b/app/models/course_group.rb index 9c80c85a..c5b66d87 100644 --- a/app/models/course_group.rb +++ b/app/models/course_group.rb @@ -1,6 +1,7 @@ class CourseGroup < ActiveRecord::Base # attr_accessible :title, :body belongs_to :course + has_many :course_members has_many :members has_many :memberships, :class_name => 'Member' has_many :member_principals, :class_name => 'Member', diff --git a/app/models/course_member.rb b/app/models/course_member.rb new file mode 100644 index 00000000..8de272a4 --- /dev/null +++ b/app/models/course_member.rb @@ -0,0 +1,7 @@ +class CourseMember < ActiveRecord::Base + # attr_accessible :title, :body + + belongs_to :course, counter_cache: true + belongs_to :user + belongs_to :course_group, counter_cache: true +end diff --git a/app/models/message.rb b/app/models/message.rb index 392bab48..9e516acb 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -54,6 +54,7 @@ class Message < ActiveRecord::Base belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id' #has_one :message_detail, :dependent => :destroy + has_one :message_detail, dependent: :destroy #转发表 has_many :forwards, :as => :from, :dependent => :destroy @@ -102,7 +103,7 @@ class Message < ActiveRecord::Base } - safe_attributes 'subject', 'content', 'reply_id', 'root_id', 'visits' + safe_attributes 'subject', 'reply_id', 'root_id', 'visits' safe_attributes 'board_id','locked', 'sticky', :if => lambda {|message, user| if message.project @@ -115,7 +116,7 @@ class Message < ActiveRecord::Base } def description - self.content + message_detail.try(:content) end # def content diff --git a/app/models/message_detail.rb b/app/models/message_detail.rb new file mode 100644 index 00000000..a12a2b8f --- /dev/null +++ b/app/models/message_detail.rb @@ -0,0 +1,4 @@ +class MessageDetail < ActiveRecord::Base + # attr_accessible :title, :body + belongs_to :message, :touch => true +end diff --git a/app/models/user.rb b/app/models/user.rb index 0e034d32..dbb77124 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -97,6 +97,8 @@ class User < Principal has_many :homework_evaluations, :dependent => :destroy has_many :syllabuses, :dependent => :destroy has_many :syllabus_members, :dependent => :destroy + + has_many :course_members, :dependent => :destroy #问卷相关关关系 has_many :poll_users, :dependent => :destroy has_many :poll_votes, :dependent => :destroy @@ -1125,7 +1127,7 @@ class User < Principal end def member_of_course?(course) - courses.to_a.include?(course) || User.current.business? + course.course_members.exists?(user_id: self.id) || User.current.business? end def member_of_contest?(contest) diff --git a/app/services/users_service.rb b/app/services/users_service.rb index d60de29c..6df15d2a 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -313,8 +313,8 @@ class UsersService limit = params[:limit]||5 page = params[:page].to_i offset = (page-1) * limit - courses = Course.find_by_sql("SELECT c.* FROM courses c, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND - mr.role_id in (3,7,9,10) AND + courses = Course.find_by_sql("SELECT c.* FROM courses c, course_members m WHERE m.course_id = c.id AND + m.role in (1,2,3,4) AND m.user_id=#{current_user.id} AND c.is_delete = 0 order by id desc limit #{limit} offset #{offset} ") # 如果还没有课程则显示示例课堂 courses = Course.where(:id => 1309) if courses.count == 0 diff --git a/app/views/managements/_classroom_classment_list.html.erb b/app/views/managements/_classroom_classment_list.html.erb index 25b13911..2b9c98cb 100644 --- a/app/views/managements/_classroom_classment_list.html.erb +++ b/app/views/managements/_classroom_classment_list.html.erb @@ -24,7 +24,7 @@ <%= (@page-1)*@limit + index + 1 %> <%= course.id %> <%= link_to course.name, course_path(course.id) ,:target => '_blank'%> - <%= course.members.count %> + <%= course.course_members_count %> <%= course.attachments.count %> <%= course.homework_commons.where(:homework_type => 1).count %> <%= course.homework_commons.where(:homework_type => 4).count %> diff --git a/app/views/managements/_course_message_list.html.erb b/app/views/managements/_course_message_list.html.erb index e2264db9..4202aaad 100644 --- a/app/views/managements/_course_message_list.html.erb +++ b/app/views/managements/_course_message_list.html.erb @@ -16,7 +16,7 @@ <%= link_to message.board.course.name, course_path(message.board.course_id), target: '_blank'%> <%= message.board.course.teacher.show_real_name %> <%= format_time(message.created_on) %> - <%= link_to message_content(message.content), board_message_path(message.board_id, message), target: '_blank'%> + <%= link_to message_content(message.description), board_message_path(message.board_id, message), target: '_blank'%> <%= Message.where(:parent_id => message.id).count %> diff --git a/app/views/managements/_shixun_task_list.html.erb b/app/views/managements/_shixun_task_list.html.erb index 27bb4e67..924b456b 100644 --- a/app/views/managements/_shixun_task_list.html.erb +++ b/app/views/managements/_shixun_task_list.html.erb @@ -25,7 +25,7 @@ <%= link_to shixun_task.name,course_path(shixun_task),:target => '_blank' %> <%= shixun_task.teacher ? link_to(shixun_task.teacher.show_real_name, user_path(shixun_task.teacher)) : "" %> <%= shixun_task.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : shixun_task.teacher.try(:user_extensions).try(:school) %> - <%= shixun_task.student.count %> + <%= shixun_task.students.count %> <% homework_commons = shixun_task.homework_commons.where(:homework_type => 4).order("IF(ISNULL(publish_time),1,0),publish_time asc,created_at asc") %> <%= homework_commons.size %> # 1 diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fb459160..e4b724ea 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -49,37 +49,37 @@
<%= current_user ? @user.identity : (@user.identity == "学生" ? "" : @user.identity) %> - <% if current_user %> - - <% if @user.authentication %> - - <% else %> - <% apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 1).last %> - - <% end %> - - - <% if @user.professional_certification %> - - <% else %> - <% apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 2).last %> - - <% end %> - - <% if @user.try(:phone).blank? %> - - <% else %> - - <% end %> - <% if @user.try(:mail).blank? %> - - <% else %> - - <% end %> - <% if @user.department_members.count > 0 %> - - <% end %> - <% else %> + <%# if current_user %> + + <%# if @user.authentication %> + + <%# else %> + <%# apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 1).last %> + + <%# end %> + + + <%# if @user.professional_certification %> + + <%# else %> + <%# apply_auth = ApplyUserAuthentication.where(:user_id => @user.id, :auth_type => 2).last %> + + <%# end %> + + <%# if @user.try(:phone).blank? %> + + <%# else %> + + <%# end %> + <%# if @user.try(:mail).blank? %> + + <%# else %> + + <%# end %> + <%# if @user.department_members.count > 0 %> + + <%# end %> + <%# else %> <% if @user.authentication %> @@ -106,10 +106,12 @@ <% else %> <% end %> - <% if @user.department_members.count > 0 %> + <% if @user.department_members.count > 0 && current_user %> + + <% elsif @user.department_members.count > 0 %> <% end %> - <% end %> + <%# end %>
diff --git a/spec/factories/course_members.rb b/spec/factories/course_members.rb new file mode 100644 index 00000000..174db783 --- /dev/null +++ b/spec/factories/course_members.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :course_member do + + end +end diff --git a/spec/factories/message_details.rb b/spec/factories/message_details.rb new file mode 100644 index 00000000..f49e24ba --- /dev/null +++ b/spec/factories/message_details.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :message_detail do + + end +end diff --git a/spec/models/course_member_spec.rb b/spec/models/course_member_spec.rb new file mode 100644 index 00000000..3972e0df --- /dev/null +++ b/spec/models/course_member_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CourseMember, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/message_detail_spec.rb b/spec/models/message_detail_spec.rb new file mode 100644 index 00000000..2a443ac1 --- /dev/null +++ b/spec/models/message_detail_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MessageDetail, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 7d1f1b6a3388d357ce2b2ceab9fdd880dbe731e0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 20 Jul 2019 19:11:21 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E6=B6=88=E6=81=AF500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/tiding.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tiding.rb b/app/models/tiding.rb index 177946d8..0cc335a5 100644 --- a/app/models/tiding.rb +++ b/app/models/tiding.rb @@ -254,7 +254,7 @@ class Tiding < ActiveRecord::Base elsif self.tiding_type == "Comment" container.present? ? ("评论了你" + (container.parent.present? ? "的回复:" : "发布的项目issue:") + message_content(container.notes)) : "" else - "更新了Issue:#{container.issue.subject}" + "更新了Issue:#{container.try(:issue).try(:subject)}" end when 'Issue' "指派了Issue给你:" + container.subject From e1ccd48d2f3b5128b985248d16c8a26f9b170eb3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 20 Jul 2019 19:16:04 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E6=B6=88=E6=81=AF500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/tiding.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tiding.rb b/app/models/tiding.rb index 0cc335a5..7204abc5 100644 --- a/app/models/tiding.rb +++ b/app/models/tiding.rb @@ -254,7 +254,7 @@ class Tiding < ActiveRecord::Base elsif self.tiding_type == "Comment" container.present? ? ("评论了你" + (container.parent.present? ? "的回复:" : "发布的项目issue:") + message_content(container.notes)) : "" else - "更新了Issue:#{container.try(:issue).try(:subject)}" + container.present? ? "更新了Issue:#{container.try(:issue).try(:subject)}" : "" end when 'Issue' "指派了Issue给你:" + container.subject From affd5769d617715cf4d92ed397817a0472c61868 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 20 Jul 2019 21:36:04 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/update.html b/public/update.html index 8c5264fe..be1b5d84 100644 --- a/public/update.html +++ b/public/update.html @@ -56,7 +56,7 @@ If you continue to experience problems please contact your Trustie administrator 温馨提示:为了给大家提供更优质的服务

- 平台拟于2019年7月19日21:30--2019年7月20号20:00进行全面升级,带来不便,敬请谅解! + 平台拟于2019年7月19日21:30--2019年7月20号22:30进行全面升级,带来不便,敬请谅解!

From 4b2c8d2163363967c76f6c5c827847691a3b706e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 20 Jul 2019 22:13:22 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_tiddings_list.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/users/_user_tiddings_list.erb b/app/views/users/_user_tiddings_list.erb index 4795fc6e..530d84b1 100644 --- a/app/views/users/_user_tiddings_list.erb +++ b/app/views/users/_user_tiddings_list.erb @@ -2,7 +2,8 @@ <% @tids.each do |tids| %> <% Rails.logger.info("------------------------tid_id---#{tids.id}") %>
-
+ +
<% system = tids.tiding_type == "System" %> <% trigger_user = tids.user %> <% eval_user = (tids.container_type == "StudentWorksScore" && tids.extra == "3") || (tids.container_type == "StudentWorksScoresAppeal" && tids.parent_container_type == "StudentWork" && tids.tiding_type == "HomeworkCommon") || (tids.container_type == "JournalsForMessage" && tids.tiding_type != "Mentioned" && tids.parent_container_type == "StudentWorksScore" && tids.container.jour.try(:reviewer_role) == 3 && !trigger_user.allowed_to?(:as_teacher, tids.container.jour.student_work.homework_common.course)) %> From fd9afc71c99e82d5128766410aca66c6e4036dbf Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 20 Jul 2019 22:16:38 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/educoder/edu_user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/javascripts/educoder/edu_user.js b/public/javascripts/educoder/edu_user.js index 54656b4a..64ce5756 100644 --- a/public/javascripts/educoder/edu_user.js +++ b/public/javascripts/educoder/edu_user.js @@ -5,10 +5,10 @@ $(function(){ $(".headphoto").find(".headphoto-black").hide(); }); - $("#user_tiddings").on("click", ".tiding_item", function(e){ - window.open($(this).attr("data-url"), "_blank"); - e.stopPropagation(); - }); + // $("#user_tiddings").on("click", ".tiding_item", function(e){ + // window.open($(this).attr("data-url"), "_blank"); + // e.stopPropagation(); + // }); $("#user_tiddings").on("click", ".tiding_user_a", function(e){ window.open($(this).attr("data-url"), "_blank");