diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 4d07c23f8..6ce01aac0 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -36,7 +36,7 @@ module Mobile principal_types = "JournalsForMessage" watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(',')) user_ids = "(" + user.id.to_s + watched_user_ids + ")" - watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? " " :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") + watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? "-1" :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") blog_ids = "(" + watched_user_blog_ids + ")" if container_type == "Course" diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 9deeec58e..b36b8039b 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -73,6 +73,12 @@ module Mobile elsif ac.container_type == "Blog" "发表博客" end + when :syllabus_title + if ac.container_type == "Course" + course = get_course(ac.container_id) + name = course.syllabus.nil? ? "":course.syllabus.title + name + end when :course_project_id if ac.container_type == "Course" ac.container_id @@ -145,6 +151,7 @@ module Mobile act_expose :latest_update #最新更新时间 act_expose :course_project_id #课程/项目ID act_expose :course_project_name #课程/项目名字 + act_expose :syllabus_title #课程名字 act_expose :activity_type_name #课程问答区/项目缺陷等 expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| if instance.act_type == "HomeworkCommon" || instance.act_type == "News" || instance.act_type == "Message" || instance.act_type == "BlogComment" || instance.act_type == "JournalsForMessage" || instance.act_type == "Issue" diff --git a/app/api/mobile/entities/course.rb b/app/api/mobile/entities/course.rb index fc78cc14e..30a5a6cc9 100644 --- a/app/api/mobile/entities/course.rb +++ b/app/api/mobile/entities/course.rb @@ -107,6 +107,7 @@ module Mobile course_expose :current_user_is_member course_expose :current_user_is_teacher course_expose :work_unit + course_expose :syllabus_title end end end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6704f7401..5e290d678 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -85,7 +85,8 @@ class HomeworkCommonController < ApplicationController homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new @homework.end_time = params[:homework_common][:end_time] || Time.now @homework.course_id = params[:course_id] - anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0 + @homework.homework_type = params[:homework_type].to_i || @homework.homework_type + anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1 if anonymous != @homework.anonymous_comment if anonymous == 1 homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 1.0 : 0.4 @@ -111,7 +112,7 @@ class HomeworkCommonController < ApplicationController if @homework.homework_type == 2 @homework.homework_detail_programing ||= HomeworkDetailPrograming.new @homework_detail_programing = @homework.homework_detail_programing - @homework_detail_programing.language = params[:language_type].to_i + @homework_detail_programing.language = params[:language_type].to_i if params[:language_type] if anonymous != @homework.anonymous_comment if anonymous == 1 @homework_detail_programing.ta_proportion = 0.6 @@ -120,8 +121,8 @@ class HomeworkCommonController < ApplicationController end end - @homework.homework_tests.delete_all - inputs = params[:program][:input] + @homework.homework_tests.delete_all if params[:program] + inputs = params[:program][:input] if params[:program] if Array === inputs inputs.each_with_index do |val, i| @homework.homework_tests << HomeworkTest.new( @@ -136,12 +137,12 @@ class HomeworkCommonController < ApplicationController if @homework.homework_type == 3 @homework.homework_detail_group ||= HomeworkDetailGroup.new @homework_detail_group = @homework.homework_detail_group - @homework_detail_group.min_num = params[:min_num].to_i - @homework_detail_group.max_num = params[:max_num].to_i - @homework_detail_group.base_on_project = params[:base_on_project].to_i + @homework_detail_group.min_num = params[:min_num].to_i if params[:min_num] + @homework_detail_group.max_num = params[:max_num].to_i if params[:max_num] + @homework_detail_group.base_on_project = params[:base_on_project].to_i if params[:base_on_project] end - @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0 + @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1 if @homework.save homework_detail_manual.save if homework_detail_manual @homework_detail_programing.save if @homework_detail_programing diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 33ff2a248..660e4d76c 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -220,7 +220,8 @@ class NewsController < ApplicationController if count == 0 ws = WechatService.new content = @news.title - ws.class_notice m.user_id, "course_notice", @news.id, "#{l(:label_new_notice_template)}", @news.course.name, @news.author.show_name, format_time(@news.created_on), content, "点击查看通知详情" + name = @news.course.syllabus.nil? ? @news.course.name : @news.course.syllabus.title+" • "+@news.course.name + ws.class_notice m.user_id, "course_notice", @news.id, "#{l(:label_new_notice_template)}", name, @news.author.show_name, format_time(@news.created_on), content, "点击查看通知详情" end end end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 7361055b4..6689bc212 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -820,17 +820,29 @@ class StudentWorkController < ApplicationController render_attachment_warning_if_needed(@new_score) if @new_score.save + if @homework.homework_type == 3 + @is_group_leader = !@work.student_work_projects.empty? + end case @new_score.reviewer_role when 1 #教师评分:最后一个教师评分为最终评分 @work.teacher_score = @new_score.score + if @is_group_leader + add_score_to_member @work, @homework, 1, 'teacher_score', @new_score.score + end when 2 #教辅评分 教辅评分显示平均分 #@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") @work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f + if @is_group_leader + add_score_to_member @work, @homework, 2, 'teaching_asistant_score', @work.teaching_asistant_score + end when 3 #学生评分 学生评分显示平均分 #@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") @work.student_score = stu_score.first.score.try(:round, 2).to_f + if @is_group_leader + add_score_to_member @work, @homework, 3, 'student_score', @work.student_score + end end @homework.update_column('updated_at', Time.now) update_course_activity(@homework.class,@homework.id) @@ -1553,10 +1565,6 @@ class StudentWorkController < ApplicationController end end end - if homework.homework_type == 3 - student_works = group_student_works student_work, homework - student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score) - end end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 559f29235..2a91b75ae 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1052,7 +1052,7 @@ class UsersController < ApplicationController else homework.publish_time = params[:homework_common][:publish_time] end - homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 + homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1 homework.homework_type = params[:homework_type].to_i || 1 homework.late_penalty = 10 homework.teacher_priority = 1 diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 0c6eb0910..92864d490 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -8,13 +8,13 @@ class WechatsController < ActionController::Base # default text responder when no other match on :text do |request, content| #邀请码 - if join_class_request(request) - sendBindClass(request, {invite_code: content}) - elsif join_project_request(request) - sendBindProject(request, {invite_code: content}) - else + # if join_class_request(request) + # sendBindClass(request, {invite_code: content}) + # elsif join_project_request(request) + # sendBindProject(request, {invite_code: content}) + # else request.reply.text "您的意见已收到,非常感谢~ \n更多问题可以通过以下方式联系我们:\n官方QQ群:173184401\n我们会认真聆听您的意见和建议。" - end + # end end # When receive 'help', will trigger this responder @@ -456,18 +456,29 @@ class WechatsController < ActionController::Base session[:wechat_openid] = open_id if params[:code] - # if params[:state].match("review_class_member") || params[:state].match("review_project_member") + if !(params[:state] == "invite_code" || params[:state] == "project_invite_code" || params[:state] == "blog_comment" || params[:state] == "course_notice" || params[:state] == "project_discussion" || params[:state] == "course_discussion" || params[:state] == "homework" || params[:state] == "issues" || params[:state] == "journal_for_message") + uw = user_binded?(open_id) + if uw + user = uw.user + lastname = user.lastname + end + end + + if lastname && lastname == "" + @path = '/edit_userinfo' + else @path = params[:state].split('/')[0] useridstr = params[:state].split('/')[1] - # end - if useridstr - redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return - elsif params[:id] - redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return - else - redirect_to "/wechat/user_activities##{@path}" and return + + if useridstr + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return + elsif params[:id] + redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return + else + redirect_to "/wechat/user_activities##{@path}" and return + end + # redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return end - # redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return end end render 'wechats/user_activities', layout: nil diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b5b6c5bd0..d3b28fb20 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3531,3 +3531,21 @@ def get_forge_act_message(act, type) format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at)) end +#作业类型 +def homework_type_option + type = [] + option1 = [] + option1 << "普通作业" + option1 << 1 + option2 = [] + option2 << "编程作业" + option2 << 2 + option3 = [] + option3 << "分组作业" + option3 << 3 + type << option1 + type << option2 + type << option3 + type +end + diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index ceff7a0a0..39c61a318 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -184,18 +184,6 @@ module CoursesHelper # garble count # end - def homework_type_option - type = [] - option1 = [] - option2 = [] - option1 << l(:label_task_submit_form_accessory) - option1 << 1 - option2 << l(:label_task_submit_form_project) - option2 << 2 - type << option1 - type << option2 - end - def proportion_option type = [] i = 0 diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index afc6cb1d9..88be249a1 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -224,19 +224,6 @@ module ProjectsHelper def get_projects_by_tag(tag_name) Project.tagged_with(tag_name).order('updated_on desc') end - - # added by fq - def homework_type_option - type = [] - option1 = [] - option2 = [] - option1 << l(:label_task_submit_form_accessory) - option1 << 1 - option2 << l(:label_task_submit_form_project) - option2 << 2 - type << option1 - type << option2 - end #是否启动互评下拉框 def is_evaluation_option diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 1e7df6466..63344fa1a 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -165,4 +165,13 @@ module StudentWorkHelper student_works = homework.student_works.where("user_id in #{user_ids}") return student_works end + + def add_score_to_member student_work, homework, role, score_type, score + student_works = group_student_works student_work, homework + student_works.each do |st_work| + if st_work.student_works_scores.where("reviewer_role = #{role} and score is not null").empty? + st_work.update_attribute("#{score_type}", score) + end + end + end end \ No newline at end of file diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index a901e6338..7a082cecf 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -77,7 +77,8 @@ class HomeworkCommon < ActiveRecord::Base count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count if count == 0 ws = WechatService.new - ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name},#{l(:label_new_homework_template)}", self.course.name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。") + name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+" • "+self.course.name + ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name},#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。") end # end end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 59e5b76bc..a3f692341 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -170,12 +170,6 @@ class StudentWork < ActiveRecord::Base end end end - if homework.homework_type == 3 - pros = student_work.student_work_projects.where("is_leader = 0") - user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")" - student_works = homework.student_works.where("user_id in #{user_ids}") - student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score) - end end end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 24e15f369..5add9979d 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -332,7 +332,7 @@ class CoursesService # unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) # raise '403' # end - {:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0} + {:course => course,:syllabus_title => course.syllabus.nil? ? "":course.syllabus.title ,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0} end #创建课程 @@ -554,8 +554,10 @@ class CoursesService uid = user.id type = "review_class_member" end + + name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name ws = WechatService.new - ws.class_notice user.id, type, course.id, title, course.name, user.show_name, format_time(Time.now), content, remark,uid + ws.class_notice user.id, type, course.id, title,name, user.show_name, format_time(Time.now), content, remark,uid end end @@ -650,8 +652,9 @@ class CoursesService rolename = role_ids.include?("7") ? "助教" : "教师" content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。" + name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name ws = WechatService.new - ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", course.name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id + ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id end end #-------------------------------------------- diff --git a/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb index f12ae67cc..caf6e052e 100644 --- a/app/services/syllabuses_service.rb +++ b/app/services/syllabuses_service.rb @@ -69,7 +69,8 @@ class SyllabusesService if count == 0 ws = WechatService.new title = "恭喜您创建班级成功。" - ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 1, "点击查看班级详情。" + name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name + ws.create_class_notice user.id, "create_course_notice", course.id,title, name, user.show_name, 1, "点击查看班级详情。" end end diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index 1bd71e7a9..4a3de027b 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -41,6 +41,20 @@
+ <% committed_work_count = @homework.student_works.has_committed.count %> + <% stu_pro_count = @homework.student_work_projects.count %> + <% if committed_work_count != 0 %> + <% if @homework.homework_type == 1 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。

+ <% elsif @homework.homework_type == 2 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。

+ <% elsif @homework.homework_type == 3 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置。

+ <% end %> + <% elsif stu_pro_count != 0 && @homework.homework_type == 3 %> +

已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。

+ <% end %> + <%= form_for @homework do |f| %> diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 167ae98f0..3a171f642 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -3,13 +3,13 @@ $("#homework_name").val(""); $("#homework_publish_time").val(""); $("#homework_end_time").val(""); - document.getElementById("anonymous_comment").checked = true; $("#course_id").val($("#option_select").val()); + $("#homeworkSetting").addClass("undis"); + $("#homeworkSetting").html(""); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>"); //homework_description_editor.html(""); $("#homework_name_span").text(""); $("#homework_end_time_span").text(""); - $("#homework_end_time_span").text(""); $("#homework_course_id_span").text(""); $("#homework_editor").toggle(); } diff --git a/app/views/student_work/_evaluation_un_group.html.erb b/app/views/student_work/_evaluation_un_group.html.erb new file mode 100644 index 000000000..91907aadf --- /dev/null +++ b/app/views/student_work/_evaluation_un_group.html.erb @@ -0,0 +1,26 @@ +
+ <% @stundet_works.each_with_index do |student_work, i| %> +
+ <%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %> +
+
+ +
+ <%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %> +
+ <% end %> +
+
+ + \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_group_member_work.html.erb b/app/views/student_work/_evaluation_un_group_member_work.html.erb new file mode 100644 index 000000000..85ae7a70d --- /dev/null +++ b/app/views/student_work/_evaluation_un_group_member_work.html.erb @@ -0,0 +1,82 @@ + + + \ No newline at end of file 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 b4337eeb2..c937ac9e9 100644 --- a/app/views/student_work/_evaluation_un_group_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_work.html.erb @@ -1,89 +1,73 @@ - - - <%=index + 1 %> - - <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %> - +
+ + + + + <% if student_work.work_status%> + <%=get_status student_work.work_status %> + <% end %> + + <% if @homework.homework_detail_group.base_on_project == 1 %> - -
- <%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%> -
- + 关联项目: <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> - - <%= link_to( student_work.project.name, project_path(student_work.project.id))%> - + <%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "width:200px;", :title => "项目名称"%> <% else %> - - <%= student_work.project.name %> - + <% end %> - <% elsif @homework.homework_detail_group.base_on_project == 0 %> - -
- <%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%> -
- <% end %> - - <% if student_work.created_at && @homework.end_time%> - <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  - <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %> - [迟交] - <% end %> + 评分 +
+
+
+ 提交时间:<%=format_date(student_work.commit_time) %> +
+
教师:<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
+
助教:<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
+ <% if @homework.anonymous_comment == 0 %> +
匿评: +
+ <% if student_work.student_score.nil? %> + 未参与 + <% else %> + <%= format("%.1f", student_work.student_score) %> + <% end %> + <% unless student_work.student_score.nil? %> + + (<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>) + +
+ 现共有 +  <%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>  + 名学生进行了匿评,平均分为 +  <%= format("%.1f", student_work.student_score) %> 分。 +
+ <% end %> +
+
<% end %> - - - <%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%> - - - <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%> - - <% if @homework.anonymous_comment == 0%> - - <% if student_work.student_score.nil? %> - 未参与 - <% else %> - <%=format("%.1f",student_work.student_score) %> - <% end %> - <% unless student_work.student_score.nil?%> - - (<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>) - -
- 现共有 -  <%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>  - 名学生进行了匿评,平均分为 -  <%= format("%.1f",student_work.student_score)%> 分。 +
成绩: + <% score = student_work.work_score %> +
+ <%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%> + <% unless score.nil?%> +
+ 作品最终评分为 +  <%= student_work.final_score%> 分。 + 迟交扣分 +   + <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %> +  分, + 缺评扣分 +   + <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%> +  分, + 最终成绩为 +  <%= format("%.1f",score<0 ? 0 : score)%> 分。
<% end%> - - <% end %> - - <% if student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score %> - <% score = student_work.respond_to?("score") ? student_work.score : student_work.teacher_score %> - <% else %> - <% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%> - <% end %> - - <%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%> - <% unless score.nil?%> -
- 作品最终评分为 -  <%= student_work.final_score%> 分。 - 迟交扣分 -   - <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %> -  分, - 缺评扣分 -   - <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%> -  分, - 最终成绩为 -  <%= format("%.1f",score<0 ? 0 : score)%> 分。 -
- <% end%> - -
- \ No newline at end of file +
+
+
+
+
\ No newline at end of file diff --git a/app/views/student_work/_group_member_work.html.erb b/app/views/student_work/_group_member_work.html.erb new file mode 100644 index 000000000..bfe25c982 --- /dev/null +++ b/app/views/student_work/_group_member_work.html.erb @@ -0,0 +1,11 @@ +<% user_ids = student_work.student_work_projects.empty? ? "(-1)" : "(" + student_work.student_work_projects.map{|st| st.user_id}.join(",") + ")" %> +<% student_work_groups = @homework.student_works.where("user_id in #{user_ids}").order("created_at asc") %> +<% anon_count = student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %> +<% student_work_groups.each_with_index do |st, j| %> +
+ <%= render :partial => 'evaluation_un_group_member_work', :locals => {:st => st, :anon_count => anon_count} %> +
+ <% if j != 0 %> +
+ <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/student_work/_group_work_show.html.erb b/app/views/student_work/_group_work_show.html.erb new file mode 100644 index 000000000..00e90b2d0 --- /dev/null +++ b/app/views/student_work/_group_work_show.html.erb @@ -0,0 +1,145 @@ +
+
+ <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> + <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> + <% is_my_work = pro && pro.student_work_id == work.id%> +
    +
  • + 上交时间: + <%=format_time work.created_at %> +
  • + + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> + +
  • + <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %> +
  • +
  • + <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%> +
  • + <% end%> + <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %> + +
  • + <%= render :partial => 'student_work_praise',:locals => {:work => work} %> +
  • + <% end%> +
    + + + + <% if work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> +
    +
  • + 参与人员: + <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> + <% members = work.student_work_projects.where("is_leader = 0") %> + <% members.each do |member| if !members.empty? %> + 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> + <% end %> + <% end %> +
  • + <% if @homework.homework_detail_group.base_on_project == 1 %> +
  • + 关联项目: + <% if work.project_id == 0 || work.project_id.nil? %> + 暂无 + <% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> + <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + (综合评分:<%=static_project_score(work.project.project_score).to_i %>) + <% else %> + <%=work.project.name %> + (综合评分:<%=static_project_score(work.project.project_score).to_i %>) + <% end %> + <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> +
  • + <% end %> +
  • + 内容: +
    + <%= work.description.html_safe if work.description%> +
    +
    +
  • +
  • + 附件: + <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> + <% if com_attachments.empty?%> + 尚未提交附件 + <% else%> +
    + <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %> +
    + <% end%> +
    +
  • + <% end%> + +
  • + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%> + +
    + <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> +
    + <% end%> +
    +
  • +
+ +
+ <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
+
+ +
+ <%student_work_scores.each do |student_score|%> +
+ <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> +
+ <% end%> +
+
+ + 收起 +
+
+ \ No newline at end of file diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 9f65376e3..a45eca30b 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -7,6 +7,8 @@ <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> <% is_my_work = pro && pro.student_work_id == work.id%> <% end %> + <% is_member_work = @homework.homework_type == 3 && work.student_work_projects.empty? %> + <% if !is_member_work %>
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
+ <% else %> + + <% end %>
<%student_work_scores.each do |student_score|%> @@ -101,6 +115,9 @@ <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
<% end%> + <% if is_member_work && student_work_scores.empty? && !@is_teacher %> +

暂无评分

+ <% end %>
diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index dbde6d24c..73f37602b 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -36,11 +36,19 @@
- <% if @is_evaluation && !@stundet_works.empty?%> - <%= render :partial => "evaluation_title"%> - <% else%> - <%= render :partial => "evaluation_un_title"%> - <% end%> + <% if @homework.homework_type != 3%> + <% if @is_evaluation && !@stundet_works.empty? %> + <%= render :partial => "evaluation_title"%> + <% else%> + <%= render :partial => "evaluation_un_title"%> + <% end%> + <% else %> + <% if !@is_teacher && @is_evaluation && !@stundet_works.empty? %> + <%= render :partial => "evaluation_title"%> + <% else %> + <%= render :partial => "evaluation_un_group"%> + <% end%> + <% end %>
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index c961fb077..6acf9eb45 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -11,8 +11,18 @@ var num = $("#work_num_<%= @work.id%>").html(); $("#score_list_<%= @work.id%>").removeAttr("style"); <% if @is_teacher %> - $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>"); - $("#work_num_<%= @work.id%>").html(num); + <% if @homework.homework_type == 3 %> + <% if @is_group_leader %> + $("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_work', :locals => {:student_work => @work}) %>"); + $("#group_member_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'group_member_work', :locals => {:student_work => @work}) %>"); + <% else %> + <% anon_count = @work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %> + $("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_member_work', :locals => {:st => @work, :anon_count => anon_count}) %>"); + <% end %> + <% else %> + $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>"); + $("#work_num_<%= @work.id%>").html(num); + <% end %> <% else %> $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>"); $("#work_num_<%= @work.id%>").html(num); diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index 6d09f6896..4596ef411 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -1,27 +1,27 @@ -分组设置 - -
- 每组最小人数: - 人 - +
+
分组设置: +
每组最小人数: + />人 +
+
每组最大人数: + />人 +
+ +
+
+ +

提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计

+
+
+
-
- 每组最大人数: - 人 - -
-

-
- -

提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计

-
-
- 确定 -
-
- 取消 -
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 6051d8de9..4f35326b0 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -71,17 +71,6 @@ 上传附件 <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作业的附件", :remote => true %> - <% if defined?(has_program) && has_program %> -
- 编程 - -
- <% end %> - <% if defined?(has_group) && has_group %> -
- 分组 -
- <% end %>
<% content_for :header_tags do %> diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index b3f9970c6..f225e4fcd 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -1,3 +1,4 @@ +<% not_allow_select = edit_mode && homework.student_works.has_committed.count != 0 %> <% content_for :header_tags do %> <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> @@ -5,14 +6,31 @@ - - - - - - - - <% unless edit_mode %>