diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index db18566db..4af7d6644 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -558,6 +558,35 @@ class CoursesController < ApplicationController end end + def delete_member + member = @course.members.find params[:member_id] + student_role = member.member_roles.where("role_id = 10").first + if member && member.deletable? && student_role + user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, @course.id) + if user_admin.size > 0 + user_admin.destroy_all + end + joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id) + joined.destroy_all + + if member.member_roles.count > 1 + student_role.destroy + member.update_attribute("course_group_id", 0) + else + member.destroy + end + #移出课程发送消息 + CourseMessage.create(:user_id => member.user_id, :course_id => @course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => User.current.id) + + @course_groups = @course.course_groups + @no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count + @canShowCode = isCourseTeacher(User.current.id,@course) + respond_to do |format| + format.js + end + end + end + def handle_course courses, activities course_activity_count_array=activities.values() course_array=[] @@ -800,11 +829,11 @@ class CoursesController < ApplicationController end if @course #发送微信消息 - count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count - if count == 0 - ss = SyllabusesService.new - ss.send_wechat_create_class_notice User.current,@course - end + # count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count + # if count == 0 + # ss = SyllabusesService.new + # ss.send_wechat_create_class_notice User.current,@course + # end respond_to do |format| flash[:notice] = l(:notice_successful_create) format.html {redirect_to course_url(@course)} diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 0be18ea5c..5f0dbda97 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -337,7 +337,7 @@ class MembersController < ApplicationController else joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) joined.each do |join| - join.delete + join.destroy end @member.course_group_id = 0 end @@ -423,7 +423,7 @@ class MembersController < ApplicationController end joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) joined.each do |join| - join.delete + join.destroy end @roles = Role.givable.all[3..5] @members = @course.member_principals.includes(:roles, :principal).all.sort diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8a5441647..f788efd3f 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -597,14 +597,14 @@ class StudentWorkController < ApplicationController @student_work_project.student_work_id = student_work.id @student_work_project.save elsif @homework.homework_detail_group.base_on_project == 0 - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1, :course_id => @homework.course_id) stu_project.save end members = params[:group_member_ids].split(',') for i in 1 .. members.count-1 stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>members[i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time) if stu_work.save - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0, :course_id => @homework.course_id) stu_project.save end end @@ -662,7 +662,7 @@ class StudentWorkController < ApplicationController for i in 1 .. members.count-1 stu_work = StudentWork.new(:name => @work.name, :description => @work.description,:user_id=> members[i].to_i, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time) if stu_work.save - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0, :course_id => @homework.course_id) stu_project.save end end @@ -1095,6 +1095,7 @@ class StudentWorkController < ApplicationController @project.project_id = params[:projectName].to_i @project.user_id = User.current.id @project.is_leader = 1 + @project.course_id = @homework.course_id if @project.save @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i @@ -1180,7 +1181,7 @@ class StudentWorkController < ApplicationController unless work stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>params[:member_id][i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => Time.now) if stu_work.save - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => params[:member_id][i].to_i, :is_leader => 0) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => params[:member_id][i].to_i, :is_leader => 0, :course_id => @homework.course_id) stu_project.save end end diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 304ba10a2..da0c5733a 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -125,7 +125,7 @@ class WatchersController < ApplicationController joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id]) joined.each do |join| - join.delete + join.destroy end end respond_to do |format| diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index de232a423..e4b480e2f 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -102,7 +102,11 @@ class WordsController < ApplicationController @user_activity_id = params[:user_activity_id] if params[:user_activity_id] @activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id] unless @activity - redirect_to feedback_path(@user) + if params[:user_activity_id] == params[:activity_id] + redirect_to feedback_path(@user) + else + redirect_to user_path(@user) + end return end elsif @journal_destroyed.jour_type == 'HomeworkCommon' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 16bbe23e8..051d601de 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2896,7 +2896,7 @@ module ApplicationHelper end #根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量 - def user_for_homework_common homework,is_teacher + def user_for_homework_common homework,is_teacher,work count = homework.student_works.has_committed.count if User.current.member_of_course?(homework.course) if is_teacher #老师显示作品数量 diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 37c4c037c..e97d32523 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -895,7 +895,7 @@ module CoursesHelper desc.html_safe end - # 学生按作业总分排序,取前3个 + # 学生按作业总分排序,取前6个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( SELECT SUM(work_score) @@ -907,14 +907,15 @@ module CoursesHelper FROM members JOIN students_for_courses ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id - WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 3" + WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 6" homework_scores = Member.find_by_sql(sql_select) end def contributor_course_scor(course_id) - ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by - (message_num*2 + message_reply_num + news_reply_num + news_num + - resource_num*5 + journal_num + homework_journal_num ) desc limit 3;") + ccs = CourseContributorScore.find_by_sql("SELECT ccs.*, (message_num*2 + message_reply_num + news_reply_num + news_num + + resource_num*5 + journal_num + homework_journal_num ) as con_score FROM `course_contributor_scores` ccs JOIN students_for_courses sfs + ON sfs.student_id = ccs.user_id AND sfs.course_id = ccs.course_id where ccs.course_id = #{course_id} order by + con_score desc limit 6;") end #用户在该课程是否具有某个角色 diff --git a/app/models/course.rb b/app/models/course.rb index 13050ddbe..f974d0e93 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -49,6 +49,7 @@ class Course < ActiveRecord::Base #has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy has_many :news, :dependent => :destroy, :include => :author has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy + has_many :student_work_projects, :dependent => :destroy has_many :homework_commons, :dependent => :destroy has_many :student_works, :through => :homework_commons, :dependent => :destroy diff --git a/app/models/students_for_course.rb b/app/models/students_for_course.rb index 6958cfe73..767d65b10 100644 --- a/app/models/students_for_course.rb +++ b/app/models/students_for_course.rb @@ -7,5 +7,13 @@ class StudentsForCourse < ActiveRecord::Base validates_presence_of :course_id, :student_id validates_uniqueness_of :student_id, :scope => :course_id - + + after_destroy :delete_student_works + + def delete_student_works + course = self.course + homework_ids = course.homework_commons.blank? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")" + student_works = StudentWork.where("user_id = #{self.student_id} && homework_common_id in #{homework_ids}") + student_works.destroy_all + end end diff --git a/app/models/user.rb b/app/models/user.rb index 96f0c5c3b..85653feef 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -966,8 +966,12 @@ class User < Principal #是否具有老师角色 def has_teacher_role(course) member = course.members.where("user_id = #{self.id}").first - role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)") - !role.blank? + if !member.nil? + role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)") + !role.blank? + else + return false + end end #是否具有学生角色 @@ -992,6 +996,13 @@ class User < Principal # Admin users are authorized for anything else return true if admin? + course_ids = context.student_work_projects.blank? ? "(-1)" : "(" + context.student_work_projects.map{|swp| swp.course_id}.join(",") + ")" + courses = Course.where("id in #{course_ids}") + courses.each do |course| + if self.has_teacher_role(course) + return true + end + end roles = roles_for_project(context) return false unless roles roles.any? {|role| diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 69864f226..f72623d84 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -207,7 +207,7 @@ class CoursesService unless member.role_ids.include?(10) joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,c.id) joined.each do |join| - join.delete + join.destroy end end @@ -460,7 +460,7 @@ class CoursesService @member.first.destroy joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id]) joined.each do |join| - join.delete + join.destroy end @state = 0 @state @@ -837,7 +837,7 @@ class CoursesService member = Member.new(:role_ids =>[7], :user_id => params[:user_id],:course_id=>params[:course_id]) joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id) joined.each do |join| - join.delete + join.destroy end member.course_group_id = 0 members << member @@ -858,7 +858,7 @@ class CoursesService end joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id]) joined.each do |join| - join.delete + join.destroy end end @@ -1261,7 +1261,7 @@ class CoursesService else joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:id]) joined.each do |join| - join.delete + join.destroy end member.course_group_id = 0 end @@ -1305,7 +1305,7 @@ class CoursesService end joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id) joined.each do |join| - join.delete + join.destroy end roles = Role.givable.all[3..5] #移出课程发送消息 diff --git a/app/views/courses/_course_activity_users.html.erb b/app/views/courses/_course_activity_users.html.erb index 67ec2ede9..459f60f3d 100644 --- a/app/views/courses/_course_activity_users.html.erb +++ b/app/views/courses/_course_activity_users.html.erb @@ -23,11 +23,8 @@ 总得分为以上得分之和 <% contributor_course_scor(course.id).each do |contributor_score| %> - <% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 + - contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 + - + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 + - contributor_score.news_num.to_i * 1 %> - <% unless total_score ==0 %> + <% total_score = contributor_score.con_score %> + <% if !total_score.nil? && total_score !=0 %>
  • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "50", :height => "50", :class=> "rankPortrait"),user_path(contributor_score.user) %>

    <%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %>

    diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index 7b59b2db6..d04e14cc8 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -1,8 +1,9 @@ +<% is_teacher = User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %> <% if members.any? %> - + - - - - + <% if is_teacher %> + + <% end %> @@ -98,10 +102,10 @@ + <% if is_teacher %> + + <% end %> <% end %> diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index cb31db24f..6dffb1da3 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -5,8 +5,6 @@
  • <%= i+1 %>
    - <%= link_to e_course.syllabus.title, syllabus_path(e_course.syllabus_id), :target => '_blank', :class => "sy_class_ltitle"%> -  ·  <%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle mb10" %>
    diff --git a/app/views/courses/delete_member.js.erb b/app/views/courses/delete_member.js.erb new file mode 100644 index 000000000..144ad749b --- /dev/null +++ b/app/views/courses/delete_member.js.erb @@ -0,0 +1,4 @@ +hideModal(); +$("#member_li_<%=params[:member_id] %>").html(""); +$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>"); +$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>"); diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index da637320e..ec763961b 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -18,13 +18,13 @@
  • - +
  • -
  • 正确示例:计算机系2016秋季A班
  • -
  • 错误示例:软件工程 - 计算机系2016秋季A班
  • +
  • 正确示例:软件工程计算机系2016秋季A班
  • +
  • 错误示例:计算机系2016秋季A班
  • diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 519bef7be..82e55328b 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -39,14 +39,15 @@
  • - <%=@course.syllabus.title %> + <%=@course.syllabus.title %> <%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
  • - +
    +
  • diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 608f08a58..e3041f92c 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -6,7 +6,7 @@ <%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %>  >  <% if @course.syllabus %> - <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %> + <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey', :title => '课程名称' %>  >  <% end %> <%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %> @@ -55,8 +55,6 @@

    - <%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%> -  ·  <%=@course.name %>

    diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 3e9ba3019..1b4f38ec5 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -3,7 +3,7 @@ <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>

    - <%= link_to course.syllabus.title + course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%> + <%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>

  • + + +
  • + <% end %> - - +
    + 导  入 + 取  消 + <% end -%> diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 72131fd1d..a95d06d5c 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -566,6 +566,8 @@ function insert_MCQ(quest_type,quest_id){ var forms = $("form.new_poll_question"); if($("#polls_head_edit").is(":visible")){ alert("请先保存问卷标题及问卷描述。"); + }else if($.trim($("#polls_name_h").html()) == ""){ + alert("问卷标题不能为空"); }else if(forms.length > 0){ alert("请先保存正在编辑的题目。"); } else { @@ -585,6 +587,8 @@ function insert_MCQ(quest_type,quest_id){ var forms = $("form.new_poll_question"); if($("#polls_head_edit").is(":visible")){ alert("请先保存问卷标题及问卷描述。"); + }else if($.trim($("#polls_name_h").html()) == ""){ + alert("问卷标题不能为空"); }else if(forms.length > 0){ alert("请先保存正在编辑的题目再发布。"); } else{ diff --git a/app/views/poll/_poll_tool_bar.html.erb b/app/views/poll/_poll_tool_bar.html.erb index e598a9ff9..63647d1b6 100644 --- a/app/views/poll/_poll_tool_bar.html.erb +++ b/app/views/poll/_poll_tool_bar.html.erb @@ -4,6 +4,7 @@ * <%end%>

    +
    <% poll = poll_question.poll %> <% count = poll.poll_questions.count %> <% unless poll_question.question_number == 1 %> @@ -21,4 +22,13 @@
    <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), - method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "poll-delete", :title => "删除") %> \ No newline at end of file + method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "poll-delete", :title => "删除") %> + + \ No newline at end of file diff --git a/app/views/poll/_show_MC.html.erb b/app/views/poll/_show_MC.html.erb index c00522ed7..c610c07cd 100644 --- a/app/views/poll/_show_MC.html.erb +++ b/app/views/poll/_show_MC.html.erb @@ -7,7 +7,7 @@ <%= poll_question.question_title %>[单选题] - +
    diff --git a/app/views/poll/_show_MCQ.html.erb b/app/views/poll/_show_MCQ.html.erb index 6612a3bb6..ab77be241 100644 --- a/app/views/poll/_show_MCQ.html.erb +++ b/app/views/poll/_show_MCQ.html.erb @@ -18,7 +18,7 @@

    <% end %>
    - +
    序号序号 姓名 <%= link_to '学号', member_score_sort_course_path(:sort_type => 'student_id', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%> @@ -12,7 +13,7 @@ <% end %> + <%= link_to '作业得分', member_score_sort_course_path(:sort_type => 'score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%> <% if @sort_type == "score" && @score_sort_by == 'desc' %> @@ -24,7 +25,7 @@ 班级作业的得分总和

    + <%= link_to '测评得分', member_score_sort_course_path(:sort_type => 'ex_score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%> <% if @sort_type == "ex_score" && @score_sort_by == 'desc' %> @@ -36,7 +37,7 @@ 班级测验的得分总和

    + <%= link_to '社区得分', member_score_sort_course_path(:sort_type => 'act_score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true, :style => 'color:#000000;'%> <% if @sort_type == "act_score" && @score_sort_by == 'desc' %> @@ -56,13 +57,16 @@

    总得分 + 总得分

    积分规则
    作业得分+测评得分+社区得分

    分班
    <%= format("%0.2f", sum) %> -
    +

    - <%= user.show_name %>
    + <%= user.show_name %>(<%=user.login %>)
    资源    发布数:<%= member.resource_num.nil? ? 0 : member.resource_num %>
    问答    发布数:<%= member.message_num.nil? ? 0 : member.message_num %>回复数:<%= member.message_reply_num.nil? ? 0 : member.message_reply_num %>
    通知    提交数:<%= member.news_num.nil? ? 0 : member.news_num %>留言数:<%= member.news_reply_num.nil? ? 0 : member.news_reply_num %>
    @@ -112,7 +116,7 @@

    - <% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? || User.current == user %> + <% if is_teacher || User.current == user %> <% if @course.course_groups.empty? %> <%=member.course_group_id == 0 ? "暂无" : member.course_group.name %> <% else %> @@ -130,6 +134,11 @@ <%=member.course_group_id == 0 ? "暂无" : member.course_group.name %> <% end %> + +
    diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index 44c560dfe..43941e1ce 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,5 +1,5 @@
    - +

    <%= poll.polls_name%>

    <%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
    diff --git a/app/views/poll/_show_mulit.html.erb b/app/views/poll/_show_mulit.html.erb index e72682165..fca5a7818 100644 --- a/app/views/poll/_show_mulit.html.erb +++ b/app/views/poll/_show_mulit.html.erb @@ -8,7 +8,7 @@ [多行主观题]
    - +
    <% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
    diff --git a/app/views/poll/_show_single.html.erb b/app/views/poll/_show_single.html.erb index 88a14bccf..d3b00db55 100644 --- a/app/views/poll/_show_single.html.erb +++ b/app/views/poll/_show_single.html.erb @@ -8,7 +8,7 @@ [主观题]
    - +
    diff --git a/app/views/poll/other_poll.js.erb b/app/views/poll/other_poll.js.erb index cbaa2bbec..80b5e4719 100644 --- a/app/views/poll/other_poll.js.erb +++ b/app/views/poll/other_poll.js.erb @@ -1,13 +1,14 @@ - <% if @polls.empty? %> alert('您的其它班级下没有问卷可供导入'); <% else %> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); - - - showModal('ajax-modal', '513px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); - $('#ajax-modal').parent().addClass("popbox_polls"); + var html_value = '<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'; + pop_box_new(html_value, 510, 550); +// $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); +// +// +// showModal('ajax-modal', '513px'); +// $('#ajax-modal').siblings().remove(); +// $('#ajax-modal').before(""); +// $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +// $('#ajax-modal').parent().addClass("popbox_polls"); <% end %> \ No newline at end of file diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 104b30819..2ef7c4a26 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -241,7 +241,7 @@ } } - > +
    diff --git a/app/views/student_work/_evaluation_un_group_work.html.erb b/app/views/student_work/_evaluation_un_group_work.html.erb index a3f8b7f3b..99b0bb827 100644 --- a/app/views/student_work/_evaluation_un_group_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_work.html.erb @@ -13,10 +13,8 @@
    关联项目:
    - <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> + <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %> <%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %> - <% elsif User.current.allowed_to?(:as_teacher, @homework.course) %> - <%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称" %> <% else %> <% end %> diff --git a/app/views/student_work/_homework_post_brief.html.erb b/app/views/student_work/_homework_post_brief.html.erb index bcc8e2235..868caae96 100644 --- a/app/views/student_work/_homework_post_brief.html.erb +++ b/app/views/student_work/_homework_post_brief.html.erb @@ -5,8 +5,6 @@
    <%= link_to homework.user.show_name, user_activities_path(homework.user_id), :class => "newsBlue mr15"%> TO - <%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> - <%= link_to homework.course.name, course_path(homework.course_id), :class => "newsBlue"%>
    - <%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> - <%= link_to activity.course.name.to_s+" | 班级通知", course_news_index_path(activity.course), :class => "newsBlue" %>
    diff --git a/app/views/users/_homework_base_info.html.erb b/app/views/users/_homework_base_info.html.erb index a3d216ef2..716a860ce 100644 --- a/app/views/users/_homework_base_info.html.erb +++ b/app/views/users/_homework_base_info.html.erb @@ -14,8 +14,6 @@
    缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
    - <% end %> - <% if activity.anonymous_comment == 0%>
    匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
    @@ -27,9 +25,7 @@
    # <%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
    -<% end %> -
    -<% if activity.student_works.has_committed.count != 0 %> +
    <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> <%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %> @@ -42,13 +38,8 @@
    <% end %>
    - <% if activity.homework_type != 2 %> - <% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %> - <% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %> - <% else %> - <% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %> - <% end %> - <% student_works.includes(:user).each_with_index do |sw, i| %> + <% student_works = activity.student_works.select("student_works.*,student_works.work_score as score").where("work_score is not null and work_status != 0").order("score desc").limit(5) %> + <% student_works.includes(:user).each do |sw| %>
    <% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %> @@ -63,14 +54,11 @@

    <% end %>
    - <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> + <% score = sw.respond_to?("score") ? sw.score : sw.work_score %>

    分数:<%=format("%.1f",score.to_f < 0 ? 0 : score.to_f) %>分

    - <% if i == 4 %> - <% break %> - <% end %> <% end %> - <% if student_works.count > 5 %> + <% if student_works.count == 5 %> <%= link_to "更多>>", student_work_index_url_in_org(activity.id, 2),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> <% end %>
    @@ -83,11 +71,11 @@ <% sort_projects = project_sort_update projects %>
    - <%# first_pro = sort_projects.first %> - <% first_pro = Project.find sort_projects.first.project_id %> + <% first_pro_act = sort_projects.first %> + <% first_pro = Project.find first_pro_act.project_id %> <% commit_time = first_pro.project_score.commit_time %> - <% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> - # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目 + <%# one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> + # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(first_pro_act.updated_at) ? commit_time : first_pro_act.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
    diff --git a/app/views/users/_homework_opr.html.erb b/app/views/users/_homework_opr.html.erb index 90acbf830..ec3781232 100644 --- a/app/views/users/_homework_opr.html.erb +++ b/app/views/users/_homework_opr.html.erb @@ -1,20 +1,19 @@ +<% work = cur_user_works_for_homework activity %> <% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%> <% projects = cur_user_projects_for_homework activity %> - <% works = cur_user_works_for_homework activity %> - <% if works.nil? && projects.nil? %> + <% if work.nil? && projects.nil? %>
    <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
    - <% elsif works.nil? %> + <% elsif work.nil? %>
    <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
    <% end %> <% end %>
    - <%= user_for_homework_common activity,is_teacher %> + <%= user_for_homework_common activity,is_teacher,work %>
    -<% work = cur_user_works_for_homework activity %> <% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
    <%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %> @@ -35,11 +34,10 @@ 语言: <%= activity.language_name%>
    -<% end %> -<% if activity.homework_type == 3 && activity.homework_detail_group%> +<% elsif activity.homework_type == 3 && activity.homework_detail_group%> <% if activity.homework_detail_group.base_on_project == 1 %> -
    - 项目(<%=activity.student_work_projects.where("is_leader = 1").count %>) +
    + <%=link_to "项目(#{activity.student_work_projects.where('is_leader = 1').count})",student_work_index_url_in_org(activity.id, 3),:class => "c_blue" %>
    <% end %>
    diff --git a/app/views/users/_homework_repository_list.html.erb b/app/views/users/_homework_repository_list.html.erb index 33de70c24..57a66cb22 100644 --- a/app/views/users/_homework_repository_list.html.erb +++ b/app/views/users/_homework_repository_list.html.erb @@ -18,8 +18,6 @@
    来源:

    - <%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %> - <%=link_to homework.course.name.to_s + "(#{current_time_and_term_short(homework.course)})", course_path(homework.course), :class => 'hw_cgrey', :target => '_blank' %>

    <% if type == "2" %> diff --git a/app/views/users/_manage_homework_list.html.erb b/app/views/users/_manage_homework_list.html.erb index 3b6890610..c8371da68 100644 --- a/app/views/users/_manage_homework_list.html.erb +++ b/app/views/users/_manage_homework_list.html.erb @@ -14,8 +14,6 @@

    来源: - <%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %> - <%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %> 类别:<%=homework.homework_type_ch %> diff --git a/app/views/users/_receive_homework_list.html.erb b/app/views/users/_receive_homework_list.html.erb index c0132b04b..a31ebc1ea 100644 --- a/app/views/users/_receive_homework_list.html.erb +++ b/app/views/users/_receive_homework_list.html.erb @@ -14,8 +14,6 @@

    来源: - <%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %> - <%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %> 类别:<%=homework.homework_type_ch %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 3351ae3f2..d0c9d8650 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -8,8 +8,6 @@

    <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%> TO - <%=link_to homework_common.course.syllabus.title, syllabus_path(homework_common.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> - <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue"%>