diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index dce558ac4..1f8cdd275 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,3 +1,4 @@ + # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -31,6 +32,74 @@ class AdminController < ApplicationController @no_configuration_data = Redmine::DefaultData::Loader::no_data? end + def export_rep_static_users + rev = params[:rev] + cycle = params[:cycle] + cycle_name = (params[:cycle] == "admin_week" ? l(:label_per_week) : (params[:cycle] == "admin_month" ? l(:label_per_month) : l(:label_per_all))) + respond_to do |format| + format.html + format.xls{ + filename = "#{l(:label_user_rep_xls)}_#{cycle_name}.xls" + send_data(admin_export_rep_xls(:rev => rev, :cycle => "1"), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } + end + end + + # 管理员界面导出所有项目代码、提交次数统计 + def admin_export_rep_xls (options = {}) + cycle = params[:cycle] + g = Gitlab.client + users_results = [] + User.all.each do |user| + unless user.mail.nil? + user_mail = user.mail + user.projects.where("gpid is not null").each do |project| + begin + g.branches(project.gpid).each do |branch| + if cycle == "admin_week" + statics = g.admin_rep_stats_week(project.gpid, :rev => branch.name, :user_mail => user_mail) + elsif cycle == "admin_month" + statics = g.admin_rep_stats_month(project.gpid, :rev => branch.name, :user_mail => user_mail) + elsif cycle == "admin_all" + statics = g.admin_rep_stats_all(project.gpid, :rev => branch.name, :user_mail => user_mail) + end + unless statics.first.commits_num == "0" + user_details = {:user_id => user.id, :user_name => user.show_name, :project_id => project.id, :project_name => project.name, + :commits_num => statics.first.commits_num, :add => statics.first.add, :del => statics.first.del, :changes => statics.first.changes, :branch => branch.name} + users_results << user_details + end + end + rescue Exception => e + puts e + end + end + end + end + + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + sheet1 = book.create_worksheet :name => l(:project_module_repository) + blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 + sheet1.row(0).default_format = blue + sheet1.row(0).concat([l(:label_rep_user_id),l(:label_rep_user_name),l(:label_rep_project_id),l(:label_rep_project_name),l(:rep_branch),l(:rep_changeset),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time)]) + count_row = 1 + users_results.each do |static| + sheet1[count_row,0] = static[:user_id] + sheet1[count_row,1] = static[:user_name] + sheet1[count_row,2] = static[:project_id] + sheet1[count_row,3] = static[:project_name] + sheet1[count_row,4] = static[:branch] + sheet1[count_row,5] = static[:commits_num] + sheet1[count_row,6] = static[:add] + sheet1[count_row,7] = static[:del] + sheet1[count_row,8] = static[:changes] + sheet1[count_row,9] = Time.now.strftime('%Y-%m-%d %H:%M:%S') + count_row += 1 + end + book.write xls_report + xls_report.string + end + # 管理员界面 项目列表 def projects =begin diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1c3adeb7c..db18566db 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1516,9 +1516,8 @@ class CoursesController < ApplicationController if student_works.empty? sheet1[count_row,j+4] = 0 else - final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score - score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty - sheet1[count_row,j+4] = score <0 ? 0:score.round(2) + work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score + sheet1[count_row,j+4] = work_score <0 ? 0:work_score.round(2) end end hw_score = member.score.nil? ? 0 : member.score diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 05eec5365..297ee6551 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -206,35 +206,35 @@ class HomeworkCommonController < ApplicationController if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works.has_committed if student_works && student_works.size >= 2 - # if @homework.homework_type == 3 - # student_work_projects = @homework.student_work_projects.where("student_work_id is not null") - # student_work_projects.each_with_index do |pro_work, pro_index| - # n = @homework_detail_manual.evaluation_num - # n = n < student_works.size ? n : student_works.size - 1 - # work_index = -1 - # student_works.each_with_index do |stu_work, stu_index| - # if stu_work.id.to_i == pro_work.student_work_id.to_i - # work_index = stu_index - # end - # end - # assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) - # assigned_homeworks.each do |h| - # student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) - # student_works_evaluation_distributions.save - # end - # end - # else + if @homework.homework_type == 3 + student_work_projects = @homework.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = @homework_detail_manual.evaluation_num + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else student_works.each_with_index do |work, index| user = work.user n = @homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 assigned_homeworks = get_assigned_homeworks(student_works, n, index) assigned_homeworks.each do |h| student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) student_works_evaluation_distributions.save end end - #end + end @homework_detail_manual.update_column('comment_status', 2) @homework_detail_manual.update_column('evaluation_start', Date.today) @statue = 1 @@ -304,13 +304,15 @@ class HomeworkCommonController < ApplicationController def alert_anonymous_comment @cur_size = 0 @totle_size = 0 + @work_size = 0 if @homework_detail_manual.comment_status == 1 @totle_size = @course.student.count - @cur_size = @homework.student_works.has_committed.size + @cur_size = @homework.student_works.where("work_status != 0").size + @work_size = @homework.student_works.has_committed.size elsif @homework_detail_manual.comment_status == 2 - @homework.student_works.has_committed.map { |work| @totle_size += work.student_works_evaluation_distributions.count} + @homework.student_works.where("work_status != 0").map { |work| @totle_size += work.student_works_evaluation_distributions.count} @cur_size = 0 - @homework.student_works.has_committed.map { |work| @cur_size += work.student_works_scores.select("distinct user_id").where(:reviewer_role => 3).count} + @homework.student_works.where("work_status != 0").map { |work| @cur_size += work.student_works_scores.select("distinct user_id").where(:reviewer_role => 3).count} end @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) @user_activity_id = params[:user_activity_id].to_i @@ -394,7 +396,14 @@ class HomeworkCommonController < ApplicationController @homework_detail_manual.evaluation_end = params[:evaluation_end] end - @homework_detail_manual.evaluation_num = params[:evaluation_num] + evaluation_num = @homework_detail_manual.evaluation_num + if params[:evaluation_limit].to_i == 1 + @homework_detail_manual.evaluation_num = params[:evaluation_num] + @homework_detail_manual.absence_penalty = evaluation_num == -1 ? 5 : @homework_detail_manual.absence_penalty + else + @homework_detail_manual.evaluation_num = -1 + @homework_detail_manual.absence_penalty = 0 + end @homework_detail_manual.save @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index a38bd4096..88502a171 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -45,6 +45,9 @@ class JournalsController < ApplicationController end def diff + # 顶部导航 + @project_menu_type = 2 + @issue = @journal.issue if params[:detail_id].present? @detail = @journal.details.find_by_id(params[:detail_id]) @@ -55,7 +58,7 @@ class JournalsController < ApplicationController @diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value) respond_to do |format| format.html { - render :layout => 'new_base' + render :layout => 'base_projects' } end end diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 97222f0bd..0be18ea5c 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -104,6 +104,7 @@ class MembersController < ApplicationController @applied_message = AppliedMessage.find(params[:applied_message_id]) # @applied_message.update_attribute(:status, 3) applied_project = @applied_message.applied + project = Project.find(@applied_message.project_id) # 发送消息给被拒者,user_id对应的收到信息的用户 AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => false, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 263ffbaa5..08e221d5e 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -521,7 +521,7 @@ class PollController < ApplicationController #显示某个学生某份问卷的填写结果 def poll_result - @poll_questions = paginateHelper @poll.poll_questions,5 + @poll_questions = @poll.poll_questions @left_nav_type = 7 respond_to do |format| format.html{render :layout => 'base_courses'} diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 304ca6901..bd6c67f58 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -72,6 +72,7 @@ class RepositoriesController < ApplicationController end def export_rep_static + # 管理员界面导出所有项目 @project = Project.find(params[:id]) gpid = @project.gpid rev = params[:rev] @@ -80,7 +81,7 @@ class RepositoriesController < ApplicationController format.html format.xls{ filename = "#{@project.name.to_s}_#{l(:label_rep_xls)}.xls" - send_data(export_rep_xls(gpid, :rev => rev, :cycle => "1"), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + send_data(export_rep_xls(gpid, :rev => rev, :cycle => cycle), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) } end end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index d6300c6bf..ad22cb42c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -5,7 +5,9 @@ class StudentWorkController < ApplicationController include ApplicationHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students,:work_canrepeat] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex, + :set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project, + :search_course_students,:work_canrepeat,:add_group_member] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] @@ -689,7 +691,7 @@ class StudentWorkController < ApplicationController def show @score = student_work_score @work,User.current @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @student_work_scores = @work.student_works_scores.order("updated_at desc") + @student_work_scores = student_work_score_record(@work) respond_to do |format| format.js end @@ -827,22 +829,22 @@ class StudentWorkController < ApplicationController 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 + if @is_group_leader && params[:same_score] + add_score_to_member @work, @homework, @new_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 + if @is_group_leader && params[:same_score] + add_score_to_member @work, @homework, @new_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 + add_score_to_member @work, @homework, @new_score end end @homework.update_column('updated_at', Time.now) @@ -852,6 +854,7 @@ class StudentWorkController < ApplicationController if @work.save @work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first @count = @homework.student_works.has_committed.count + @student_work_scores = student_work_score_record @work respond_to do |format| format.js end @@ -973,7 +976,7 @@ class StudentWorkController < ApplicationController unless @homework.late_penalty.to_s == params[:late_penalty].to_s @homework.late_penalty = params[:late_penalty] - @homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work| + @homework.student_works.where("commit_time > '#{@homework.end_time} 23:59:59'").each do |student_work| student_work.late_penalty = @homework.late_penalty student_work.save end @@ -984,7 +987,7 @@ class StudentWorkController < ApplicationController if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" @homework.student_works.each do |student_work| - absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0 student_work.save end @@ -993,7 +996,7 @@ class StudentWorkController < ApplicationController homework_detail_manual.save if homework_detail_manual end - teacher_priority = params[:teacher_priority] ? 1 : 0 + teacher_priority = params[:teacher_priority].to_i if homework_detail_manual.ta_proportion.to_s != params[:ta_proportion].to_s || @homework.teacher_priority.to_s != teacher_priority.to_s || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s) homework_detail_manual.ta_proportion = params[:ta_proportion] homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing @@ -1009,7 +1012,7 @@ class StudentWorkController < ApplicationController end @homework.save - if params[:student_path] + if params[:student_path] && params[:student_path] == "true" redirect_to student_work_index_url(:homework => @homework.id) else @user_activity_id = params[:user_activity_id].to_i @@ -1149,6 +1152,41 @@ class StudentWorkController < ApplicationController render :json => req end + #作业截止后组长添加成员 + def add_group_member + student_work = @homework.student_works.where("user_id = #{User.current.id}").first + if params[:member_id] + #为新增加的成员创建作品 + for i in 1 .. params[:member_id].count do + work = StudentWork.find_by_homework_common_id_and_user_id(@homework.id, params[:member_id][i].to_i) + 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.save + end + end + end + + #未选择的成员删除作品 + student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",student_work.id,0) + student_work_projects.each do |sp| + unless params[:member_id].include?(sp.user_id.to_s) + work = StudentWork.where("homework_common_id = #{@homework.id} and user_id = #{sp.user_id}").first + sp.destroy + if work + work.destroy + end + end + end + end + respond_to do |format| + format.html { + redirect_to student_work_index_url(:homework => @homework.id, :tab => 2) + } + end + end + private def searchstudent_by_name users, name mems = [] @@ -1444,11 +1482,11 @@ class StudentWorkController < ApplicationController #成绩计算 def set_final_score homework,student_work if homework && homework.homework_detail_manual - if homework.homework_type != 2 #匿评作业 + if homework.homework_type != 2 #非编程作业 if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? student_work.final_score = student_work.student_score @@ -1491,7 +1529,7 @@ class StudentWorkController < ApplicationController if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? #教辅未评分 if student_work.student_score.nil? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f97696b67..29b4bb0b2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -93,7 +93,7 @@ module ApplicationHelper end xls_report = StringIO.new book = Spreadsheet::Workbook.new - sheet1 = book.create_worksheet :name => "版本库" + sheet1 = book.create_worksheet :name => l(:project_module_repository) blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_changeset),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle),l(:rep_author_mail)]) @@ -2905,7 +2905,7 @@ module ApplicationHelper link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red' end else - if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 && work.user_id == User.current.id #匿评作业,且作业状态不是在开启匿评之前 + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束" diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 63344fa1a..08dae571c 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -69,6 +69,15 @@ module StudentWorkHelper str end + #获取学生作品的评分记录:同一个教师或教辅只显示最后一次评分 + def student_work_score_record work + sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND student_work_id = #{work.id} GROUP BY user_id" + tea_ts_ids = StudentWorksScore.find_by_sql sql + tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")" + scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc") + return scores + end + #获取赞的总数 def praise_homework_count obj_id PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").count @@ -166,12 +175,19 @@ module StudentWorkHelper return student_works end - def add_score_to_member student_work, homework, role, score_type, score + def add_score_to_member student_work, homework, new_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) + st_work.student_works_scores << StudentWorksScore.create(:user_id => new_score.user_id, :score => new_score.score, :reviewer_role => new_score.reviewer_role, :comment => new_score.comment) + if new_score.reviewer_role == 1 + st_work.teacher_score = new_score.score + elsif new_score.reviewer_role == 2 + ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{st_work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") + st_work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f + else + st_work.student_score = student_work.student_score end + st_work.save end end end \ No newline at end of file diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 0a0c880c1..9b3124797 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -49,11 +49,11 @@ class StudentWork < ActiveRecord::Base #成绩计算 def set_final_score homework,student_work if homework && homework.homework_detail_manual - if homework.homework_type != 2 #匿评作业 + if homework.homework_type != 2 #非编程作业 if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? student_work.final_score = student_work.student_score @@ -98,7 +98,7 @@ class StudentWork < ActiveRecord::Base if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? #教辅未评分 if student_work.student_score.nil? diff --git a/app/views/admin/projects.html.erb b/app/views/admin/projects.html.erb index 4457eef59..ed173930a 100644 --- a/app/views/admin/projects.html.erb +++ b/app/views/admin/projects.html.erb @@ -77,6 +77,11 @@ <% html_title(l(:label_project_plural)) -%> +
项目代码/提交数统计: + <%= link_to "最近一周", {:controller => 'admin', :action => 'export_rep_static_users', :format => 'xls', :cycle => "admin_week" }, :confirm => l(:label_rep_admin_export_tip), :class => "linkBlue2" %> | + <%= link_to "最近一月", {:controller => 'admin', :action => 'export_rep_static_users', :format => 'xls', :cycle => "admin_month" }, :confirm => l(:label_rep_admin_export_tip), :class => "linkBlue2" %>| + <%= link_to "所有", {:controller => 'admin', :action => 'export_rep_static_users', :format => 'xls', :cycle => "admin_all" }, :confirm => l(:label_rep_admin_export_tip), :class => "linkBlue2" %> +
\ No newline at end of file diff --git a/app/views/homework_common/_set_score_rule_non_pro.html.erb b/app/views/homework_common/_set_score_rule_non_pro.html.erb new file mode 100644 index 000000000..afa768838 --- /dev/null +++ b/app/views/homework_common/_set_score_rule_non_pro.html.erb @@ -0,0 +1,101 @@ +
+
+

评分设置

+ +
+
+ <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + +
      +
    • + + +
    • +
    • + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> + 助教评分 +
    • +
    • + + 学生匿评 +
    • +
    +
  • +
+
    + + + + +
+
+ 确定 + 取消 +
+
+<% end %> +
+ + \ No newline at end of file diff --git a/app/views/homework_common/_set_score_rule_none_pro_anon.html.erb b/app/views/homework_common/_set_score_rule_none_pro_anon.html.erb new file mode 100644 index 000000000..cb8ca942f --- /dev/null +++ b/app/views/homework_common/_set_score_rule_none_pro_anon.html.erb @@ -0,0 +1,69 @@ +
+
+

评分设置

+ +
+
+ <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
+
+
    +
  • + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
+
    + + + +
+
+ 确定 + 取消 +
+
+ <% end %> +
+ + \ No newline at end of file diff --git a/app/views/homework_common/_set_score_rule_pro.html.erb b/app/views/homework_common/_set_score_rule_pro.html.erb new file mode 100644 index 000000000..bf1432fdd --- /dev/null +++ b/app/views/homework_common/_set_score_rule_pro.html.erb @@ -0,0 +1,111 @@ +
+
+

评分设置

+ +
+
+ <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + +
      +
    • + + +
    • +
    • + <%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %> + 系统评分 +
    • +
    • + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> + 助教评分 +
    • +
    • + + 学生匿评 +
    • +
    +
  • +
+
    + + + + +
+
+ 确定 + 取消 +
+ +
+ <% end%> +
+ \ No newline at end of file diff --git a/app/views/homework_common/_set_score_rule_pro_anon.html.erb b/app/views/homework_common/_set_score_rule_pro_anon.html.erb new file mode 100644 index 000000000..a69640782 --- /dev/null +++ b/app/views/homework_common/_set_score_rule_pro_anon.html.erb @@ -0,0 +1,91 @@ +
+
+

评分设置

+ +
+
+ <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
+
+
    +
  • + + +
  • +
  • + + + +
  • +
  • + +
      +
    • + +
    • +
    • + <%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %> + 系统评分 +
    • +
    • + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> + 助教评分 +
    • +
    +
  • +
+
    + + + +
+
+ 确定 + 取消 +
+ +
+ <% end %> +
+ + \ No newline at end of file diff --git a/app/views/homework_common/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb index 96e958648..ed89ec933 100644 --- a/app/views/homework_common/alert_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_anonymous_comment.js.erb @@ -1,6 +1,2 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file +var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/alert_anonyoms') %>"; +pop_box_new(htmlvalue, 550, 171); \ No newline at end of file diff --git a/app/views/homework_common/score_rule_set.js.erb b/app/views/homework_common/score_rule_set.js.erb index 2ea1fe4a5..abe8800e7 100644 --- a/app/views/homework_common/score_rule_set.js.erb +++ b/app/views/homework_common/score_rule_set.js.erb @@ -1,6 +1,27 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>'); -showModal('ajax-modal', '350px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file +<% if @homework.homework_type == 2 %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 570, 355); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 500, 285); + <% end %> +<% else %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 500, 325); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 500, 225); + <% end %> +<% end %> +function set_score_rule_submit() { + if($("#late_penalty_num").val() == ""){ + $("#late_penalty_num").val("0"); + } + if($("#absence_penalty_num").val() == ""){ + $("#absence_penalty_num").val("0"); + } + $('#muban_popup_box').find('form').submit(); + hideModal(); +} \ No newline at end of file diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb index e084967c7..c65034689 100644 --- a/app/views/homework_common/set_evaluation_attr.js.erb +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -1,4 +1,3 @@ -clickCanel(); <% if @hw_status == 5 %> $("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); <% else %> diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb index 3ece646dc..24ecbd340 100644 --- a/app/views/homework_common/start_evaluation_set.js.erb +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -1,10 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>'); +var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>"; +pop_box_new(htmlvalue, 550, 315); var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; -showModal('ajax-modal', '350px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions); }); \ No newline at end of file diff --git a/app/views/journals/diff.html.erb b/app/views/journals/diff.html.erb index b842d87d0..1008441f1 100644 --- a/app/views/journals/diff.html.erb +++ b/app/views/journals/diff.html.erb @@ -1,10 +1,17 @@ -

<%=h @issue.tracker %> #<%= @issue.id %>

-

由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %>

+
+

<%=h @issue.tracker %> #<%= @issue.id %>

+

由<%= link_to @journal.user, user_path(@journal.user), :class => "c_blue" %> 更新于 <%= format_time @journal.created_on %>

+ +
+
之前版本:
<%= @detail.old_value.html_safe %>
+
+
当前版本:
<%= @detail.value.html_safe %>
+
+ <%#= @diff.to_html.gsub("<","<").gsub(">",">").gsub(""","\"").gsub("&gt;", ">").gsub("&lt;", "<").gsub("&quot;", "\"").html_safe %> +
+ +

<%= link_to l(:button_back), issue_path(@issue), :onclick => 'history.back(); return false;' %>

+ + <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> -
- <%= @diff.to_html.gsub("<","<").gsub(">",">").gsub(""","\"").gsub("&gt;", ">").gsub("&lt;", "<").gsub("&quot;", "\"").html_safe %>
- -

<%= link_to l(:button_back), issue_path(@issue), :onclick => 'history.back(); return false;' %>

- -<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index fe5885250..1988dc672 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -66,9 +66,11 @@
  • <%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
  • -
  • - <%= link_to '我的课程',{:controller => "users", :action => "user_courselist", :id => User.current.id}, :class => "menuGrey" %> -
  • + <% if hidden_unproject_infos %> +
  • + <%= link_to '我的课程',{:controller => "users", :action => "user_courselist", :id => User.current.id}, :class => "menuGrey" %> +
  • + <% end %>
  • <%= link_to "我的组织", user_organizations_user_path(:id => User.current.id), :class => "menuGrey"%>
  • diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 3ed28f418..efa38734e 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -7,7 +7,7 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus',:media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel',:media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> diff --git a/app/views/poll/_show_MCQ_result.html.erb b/app/views/poll/_show_MCQ_result.html.erb index 4129f164b..0a5f79e2e 100644 --- a/app/views/poll/_show_MCQ_result.html.erb +++ b/app/views/poll/_show_MCQ_result.html.erb @@ -2,9 +2,21 @@
    第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [多选题] <%if poll_question.is_necessary == 1%> * <%end%> + <% if poll_question.min_choices != 0 || poll_question.max_choices != 0 %> +

    + <% if poll_question.min_choices != 0 && poll_question.max_choices != 0 %> + 答题时最少选<%=poll_question.min_choices %>项、最多选<%=poll_question.max_choices %>项 + <% elsif poll_question.min_choices != 0 %> + 答题时最少选<%=poll_question.min_choices %>项 + <% elsif poll_question.max_choices != 0 %> + 答题时最多选<%=poll_question.max_choices %>项 + <% end %> +

    + <% end %>
    diff --git a/app/views/poll/_show_MC_result.html.erb b/app/views/poll/_show_MC_result.html.erb index d154468b3..141702f36 100644 --- a/app/views/poll/_show_MC_result.html.erb +++ b/app/views/poll/_show_MC_result.html.erb @@ -2,6 +2,7 @@
    第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [单选题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/_show_mulit_result.html.erb b/app/views/poll/_show_mulit_result.html.erb index da72ea35d..14ba41d5b 100644 --- a/app/views/poll/_show_mulit_result.html.erb +++ b/app/views/poll/_show_mulit_result.html.erb @@ -2,6 +2,7 @@
    第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [多行主观题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/_show_single_result.html.erb b/app/views/poll/_show_single_result.html.erb index 4fbf3698f..c5fcd4ed4 100644 --- a/app/views/poll/_show_single_result.html.erb +++ b/app/views/poll/_show_single_result.html.erb @@ -2,6 +2,7 @@
    第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [主观题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/poll_result.html.erb b/app/views/poll/poll_result.html.erb index bb9aa7f63..59096fd8c 100644 --- a/app/views/poll/poll_result.html.erb +++ b/app/views/poll/poll_result.html.erb @@ -7,50 +7,23 @@
    <%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
    - <% mc_question_list = @poll.poll_questions.where("question_type=1") %> - <% mcq_question_list = @poll.poll_questions.where("question_type=2") %> - <% single_question_list = @poll.poll_questions.where("question_type=3") %> - <% multi_question_list = @poll.poll_questions.where("question_type=4") %> -
    "> -

    单选题

    - <% mc_question_list.each do |poll_question| %> -
    -
    - <%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %> + <% @poll_questions.each do |poll_question|%> +
    +
    +
    + <% if poll_question.question_type == 1%> + <%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 2%> + <%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 3%> + <%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 4%> + <%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %> + <% end%> +
    - <% end %> -
    -
    "> -

    多选题

    - <% mcq_question_list.each do |poll_question| %> -
    -
    - <%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %> -
    -
    - <% end %> -
    -
    "> -

    单行主观题

    - <% single_question_list.each do |poll_question| %> -
    -
    - <%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %> -
    -
    - <% end %> -
    -
    "> -

    多行主观题

    - <% multi_question_list.each do |poll_question| %> -
    -
    - <%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %> -
    -
    - <% end %> -
    + <% end%>
    diff --git a/app/views/student_work/_add_or_delete_member.html.erb b/app/views/student_work/_add_or_delete_member.html.erb new file mode 100644 index 000000000..d21a91da5 --- /dev/null +++ b/app/views/student_work/_add_or_delete_member.html.erb @@ -0,0 +1,119 @@ +<% if homework.homework_detail_group %> +
    +
    +
    请从<%= homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员
    +
    +
    +
    +
    + +
    +
    +
    + <%=form_tag(add_group_member_student_work_index_path(:homework => homework.id), :method => :post, :id => 'add_group_member_form') do %> + <% str = User.current.id.to_s%> + <% student_work = StudentWork.where("homework_common_id = #{homework.id} and user_id = #{User.current.id}").first %> + <% if student_work %> + <% student_work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> + <% str += ','+pro.user_id.to_s %> + <% end %> + <% end %> + + <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %> +
      +
      +
        +
      • <%=User.current.show_name %> + <% unless User.current.user_extensions.student_id == "" %> + (<%=User.current.user_extensions.student_id %>) + <% end %> + +
      • +
      +
      + + + +
      + <% end %> +
      + +<% end %> \ No newline at end of file diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index e051a4d99..3229ddbda 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -11,6 +11,9 @@
      + <% if @is_teacher && work.homework_common.homework_type == 3 && !is_member_work %> + + <% end %>
    • <% if @is_teacher%> 批阅结果: diff --git a/app/views/student_work/_evaluation_un_group.html.erb b/app/views/student_work/_evaluation_un_group.html.erb index 9a3364258..6b973aedc 100644 --- a/app/views/student_work/_evaluation_un_group.html.erb +++ b/app/views/student_work/_evaluation_un_group.html.erb @@ -3,8 +3,6 @@
      <%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %>
      -
      -
      <%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %>
      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 index 240bac3d5..9a03fbdc6 100644 --- a/app/views/student_work/_evaluation_un_group_member_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_member_work.html.erb @@ -1,30 +1,31 @@ + <% is_expand = st.student_work_projects.empty? %>
      • -
        > +
        <%= link_to(image_tag(url_to_avatar(st.user),:width =>"40",:height => "40", :style => "display:block;"),user_activities_path(st.user), :class => "fl") %> <% if !is_expand %> - - + + (组长) -
      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 11a40bebd..54494ce57 100644 --- a/app/views/student_work/_evaluation_un_group_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_work.html.erb @@ -1,98 +1,65 @@
      - - - - <% if student_work.work_status%> - <%=get_status student_work.work_status %> - <% end %> - - + + + + <% if student_work.work_status %> + <%= get_status student_work.work_status %> + <% end %> + + +
      <% if @homework.homework_detail_group.base_on_project == 1 %> -
      + 关联项目: +
      <% 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), :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称", :target => "_blank"%> + <%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:200px;", :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 fr hidden', :style => "max-width:200px;", :title => "项目名称" %> + <%= 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:200px;", :title => "项目名称" %> <% else %> <% end %> <% project = student_work.project %> -
      +
      +

      <%= project.name %>

      -

      创建者:<%=project.creater %>成员数量:<%=project.members.count %>

      + +

      + 创建者:<%= project.creater %>成员数量:<%= project.members.count %>

      <% project_score = project.project_score %> -

      项目综合得分:<%=static_project_score(project_score).to_i %>

      +

      项目综合得分:<%= static_project_score(project_score).to_i %>

      +

      = 代码提交得分 + issue得分 + 资源得分 + 帖子得分

      -

      = <%=(project_score.changeset_num||0) * 4 %> + <%=project_score.issue_num * 4 + project_score.issue_journal_num %> + <%=project_score.attach_num * 5 %> + <%=project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %>

      + +

      = <%= (project_score.changeset_num||0) * 4 %> + + <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %> + + <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %>

      - 关联项目: <% 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)%>
      + 提交时间:<%= format_date(student_work.commit_time) %> + 学号 + +
      +
      教师
      +
      助教
      <% 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 %> -
      成绩: - <% 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%> -
      -
      +
      成绩
      - 评分
      \ No newline at end of file diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index e25196790..9b247f3d6 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -104,11 +104,11 @@  <%= 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.late_penalty %>  
      缺评扣分   - <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%> + <%= student_work.absence_penalty%>  
      最终成绩为  <%= format("%.1f",score<0 ? 0 : score)%> 
      diff --git a/app/views/student_work/_group_member_work.html.erb b/app/views/student_work/_group_member_work.html.erb index d9a2cf726..8ff10e513 100644 --- a/app/views/student_work/_group_member_work.html.erb +++ b/app/views/student_work/_group_member_work.html.erb @@ -5,7 +5,5 @@
      <%= 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/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 6d5538e23..93493b5b4 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -94,7 +94,7 @@ <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
      - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> + <%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => false}%>
      <% end%>
      @@ -106,12 +106,8 @@
      -
      - <%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%> +
      + <%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => false} %>
      diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index cb9c7fbe0..185f6520b 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -84,7 +84,7 @@ <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
      - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> + <%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>
      <% end%>
      @@ -101,7 +101,7 @@ <% if @is_teacher %>
      - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> + <%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>
      <% end%>
      @@ -109,15 +109,8 @@ <% end %> -
      - <%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%> - <% if is_member_work && student_work_scores.empty? && !@is_teacher %> -

      暂无评分

      - <% end %> +
      + <%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>
      diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 66911d15f..5a66b538c 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -2,7 +2,12 @@ 作品 - (<%= @student_work_count%><%=@homework.homework_type == 3 ? '组' : '人' %>已交) + <% if @homework.homework_type == 3 %> + <% member_count = @homework.student_works.where("work_status != 0").count %> + (<%= @student_work_count%>组<%=member_count %>人已交) + <% else %> + (<%= @student_work_count%>人已交) + <% end %> <%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %> <% my_work = cur_user_works_for_homework @homework %> @@ -31,17 +36,17 @@ <%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %> <% end %> <% end%> - <%# if @homework.homework_type == 3 && my_work && my_work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") %> - - - - <%# end %> + <% if @homework.homework_type == 3 && my_work && my_work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") %> + + <% end %> <% if @is_teacher && @homework.homework_type == 3 %>
      -

      大作品评分即组长的评分
      - 请先完成大作品评分,系统将把大作品
      评分做为每个组员的初始分值,您需
      要在此基础上对组员评分进行手动调整 +

      组长评分即小组作品评分
      + 组长评分时选择“组员同评”,本次评
      分结果将同时影响每个组员的评分。
      您可以继续对单个组员评分再调整或
      不调整

      <% end %> @@ -76,7 +81,7 @@ <% unless work.nil? %> location.hash = "<%=work.id %>"; <% if @homework.homework_type == 2 %> - $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); + $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>"); var program_name = "text/x-csrc"; var language = <%= @homework.language %>; @@ -100,9 +105,9 @@ value: $("#work-src_<%= work.id%>").text() }); <% elsif @homework.homework_type == 1 %> - $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); + $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>"); <% elsif @homework.homework_type == 3 %> - $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); + $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>"); <% end %> $('#score_<%= work.id%>').peSlider({range: 'min'}); <% end %> @@ -110,7 +115,7 @@ }); function add_or_delete_group_member() { - var html_value = "<%#= escape_javascript(render :partial => 'student_work/add_or_delete_member',:locals => {:homework=>@homework,:edit_mode => true}) %>"; - pop_up_box(html_value, 528); + var html_value = "<%= escape_javascript(render :partial => 'student_work/add_or_delete_member',:locals => {:homework=>@homework,:edit_mode => true}) %>"; + pop_up_box(html_value, 530); } \ No newline at end of file diff --git a/app/views/student_work/_student_work_score_records.html.erb b/app/views/student_work/_student_work_score_records.html.erb new file mode 100644 index 000000000..b0215d127 --- /dev/null +++ b/app/views/student_work/_student_work_score_records.html.erb @@ -0,0 +1,8 @@ +<%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%> +<% if is_member_work && student_work_scores.empty? && !@is_teacher %> +

      暂无评分

      +<% end %> \ No newline at end of file diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 6acf9eb45..ce9eee14d 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -1,12 +1,14 @@ -$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score}) %>"); +<% is_member_work = @homework.homework_type == 3 && @work.student_work_projects.empty? %> +$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score,:is_member_work => is_member_work}) %>"); $('#score_<%= @work.id%>').peSlider({range: 'min'}); -<% if @is_new%> - $("#score_list_<%= @work.id%>").prepend("
      <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last_a}) %>
      "); -<% else %> - $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>"); -<% end%> +<%# if @is_new%> + //$("#score_list_<%#= @work.id%>").prepend("
      <%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last_a}) %>
      "); +<%# else %> + //$("#work_score_<%#= @score.id%>").html("<%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>"); +<%# end%> +$("#score_list_<%= @work.id%>").replaceWith("<%=escape_javascript(render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => is_member_work}) %>"); var num = $("#work_num_<%= @work.id%>").html(); $("#score_list_<%= @work.id%>").removeAttr("style"); diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index b92152049..ab69f0c4b 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -48,14 +48,36 @@ // }); <%# end%> + function set_score_rule_submit() { + if($("#late_penalty_num").val() == ""){ + $("#late_penalty_num").val("0"); + } + if($("#absence_penalty_num").val() == ""){ + $("#absence_penalty_num").val("0"); + } + $('#muban_popup_box').find('form').submit(); + hideModal(); + } + //设置评分规则 function set_score_rule(){ - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework,:student_path => true}) %>'); - showModal('ajax-modal', '350px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); + <% if @homework.homework_type == 2 %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 570, 355); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 500, 285); + <% end %> + <% else %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 500, 325); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 500, 225); + <% end %> + <% end %> } diff --git a/app/views/student_work/search_course_students.js.erb b/app/views/student_work/search_course_students.js.erb index 65179317f..24ee9af61 100644 --- a/app/views/student_work/search_course_students.js.erb +++ b/app/views/student_work/search_course_students.js.erb @@ -26,7 +26,7 @@ $("#all_students_list").empty(); <% if user.id.to_i != User.current.id.to_i %> li += " onclick='delete_student(<%=user.id %>);'"; <% end %> - li += ">" + $("#student_<%=user.id %>").html()+"
    • "; + li += ">" + $("#student_<%=user.id %>").html()+""; $("#choose_students_list").append(li); }); } diff --git a/app/views/student_work/set_score_rule.js.erb b/app/views/student_work/set_score_rule.js.erb index 58aaa6f3e..964764df8 100644 --- a/app/views/student_work/set_score_rule.js.erb +++ b/app/views/student_work/set_score_rule.js.erb @@ -1,4 +1,3 @@ -clickCanel(); <% if @hw_status != 5 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); <% if @user_activity_id != @homework.id %> @@ -8,4 +7,4 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(r <% end %> <% else %> window.location.href = '<%=student_work_index_url(:homework => @homework.id) %>'; -<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb index 6adcae4a7..05555d341 100644 --- a/app/views/syllabuses/_syllabus_course_list.html.erb +++ b/app/views/syllabuses/_syllabus_course_list.html.erb @@ -79,7 +79,8 @@ <% if User.current.member_of_syl?(@syllabus) %>

      该课程还未创建班级,请 <%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_corange", :target => '_blank'%> - ,谢谢啦!

      + ,谢谢啦!
      只有创建班级后才可以开展在线教学哦~ +

      <% else %>

      该课程还未创建班级,敬请期待!

      <% end %> diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb index 7e5af4ec0..7587262eb 100644 --- a/app/views/syllabuses/show.html.erb +++ b/app/views/syllabuses/show.html.erb @@ -28,6 +28,9 @@
      + <% if User.current == @syllabus.user && @syllabus.courses.empty? %> +

      您还没有创建班级,只有<%= link_to "创建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "linkBlue2", :target => '_blank'%>后才可以开展在线教学哦~

      + <% end %> <% if @syllabus.des_status == 0 && User.current == @syllabus.user %>

      您建立的课程尚未填写课程大纲,请完善您的 <%=link_to '课程大纲', edit_syllabus_path(@syllabus), :class => 'sy_corange' %>,谢谢啦!

      diff --git a/app/views/users/_homework_base_info.html.erb b/app/views/users/_homework_base_info.html.erb index 0cdbbdb1a..a3d216ef2 100644 --- a/app/views/users/_homework_base_info.html.erb +++ b/app/views/users/_homework_base_info.html.erb @@ -29,7 +29,7 @@
      <% end %>
      -<% if activity.student_works.count != 0 %> +<% 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") %> @@ -64,7 +64,7 @@ <% end %> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> -

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

      +

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

      <% if i == 4 %> <% break %> @@ -112,7 +112,7 @@ <% if activity.anonymous_comment == 0 %>
    • - <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%> + <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status < 2%>
    • <%= homework_anonymous_comment activity,hw_status,user_activity_id %> diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 2c0180755..75125f258 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -202,8 +202,17 @@ zh: label_issue_new: 新建问题 label_query: 自定义查询 label_issue_list_xls: Issue列表 + label_per_week: 每周 + label_per_month: 每月 + label_per_all: 所有 label_rep_xls: 版本库代码统计 + label_user_rep_xls: 用户开发量统计 label_rep_branch: 分支 + label_rep_user_id: 用户ID + label_rep_user_name: 用户名 + label_rep_project_id: 项目ID + label_rep_project_name: 项目名 + label_rep_admin_export_tip: 导出可能会持续很长一段时间,建议在平台空闲时间导出,你确定导出吗? # Issue列表 excel导出参数 issue_xls_id: ID diff --git a/config/routes.rb b/config/routes.rb index 4a491fe09..e5a122f19 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -346,6 +346,7 @@ RedmineApp::Application.routes.draw do post 'set_score_rule' get 'work_canrepeat' get 'get_user_infor' + post 'add_group_member' end end @@ -1107,6 +1108,7 @@ RedmineApp::Application.routes.draw do match 'admin', :to => 'admin#index', :via => :get match 'admin/projects', :via => :get + match 'admin/export_rep_static_users', :via => :get get 'admin/courses', as: :all_courses get 'admin/syllabuses', as: :all_syllabuses get 'admin/non_syllabus_courses', as: :non_syllabus_courses diff --git a/lib/gitlab-cli/lib/gitlab/client/repositories.rb b/lib/gitlab-cli/lib/gitlab/client/repositories.rb index daed2ee16..3630f40dd 100644 --- a/lib/gitlab-cli/lib/gitlab/client/repositories.rb +++ b/lib/gitlab-cli/lib/gitlab/client/repositories.rb @@ -132,6 +132,22 @@ class Gitlab::Client end alias_method :repo_rep_stats, :rep_stats + # static all users + def admin_rep_stats_week(project, options={}) + get("/projects/#{project}/repository/admin_rep_stats_week", :query => options) + end + alias_method :repo_rep_stats, :rep_stats + + def admin_rep_stats_month(project, options={}) + get("/projects/#{project}/repository/admin_rep_stats_month", :query => options) + end + alias_method :repo_rep_stats, :rep_stats + + def admin_rep_stats_all(project, options={}) + get("/projects/#{project}/repository/admin_rep_stats_all", :query => options) + end + alias_method :repo_rep_stats, :rep_stats + # Gets a tree activities of project repository. # # @example diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index dc0dec270..087c6183c 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -16,35 +16,35 @@ namespace :homework_evaluation do if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评 student_works = homework_common.student_works.has_committed if student_works && student_works.size >= 2 - # if homework_common.homework_type == 3 - # student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") - # student_work_projects.each_with_index do |pro_work, pro_index| - # n = homework_detail_manual.evaluation_num - # n = n < student_works.size ? n : student_works.size - 1 - # work_index = -1 - # student_works.each_with_index do |stu_work, stu_index| - # if stu_work.id.to_i == pro_work.student_work_id.to_i - # work_index = stu_index - # end - # end - # assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) - # assigned_homeworks.each do |h| - # student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) - # student_works_evaluation_distributions.save - # end - # end - # else + if homework_common.homework_type == 3 + student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = homework_detail_manual.evaluation_num + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else student_works.each_with_index do |work, index| user = work.user n = homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 assigned_homeworks = get_assigned_homeworks(student_works, n, index) assigned_homeworks.each do |h| student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) student_works_evaluation_distributions.save end end - #end + end homework_detail_manual.update_column('comment_status', 2) # 匿评开启消息邮件通知,# 所有人 #send_message_anonymous_comment(homework_common, 2) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 6a892230e..bc9f86880 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -423,6 +423,9 @@ function showModal(id, width) { } function hideModal(el) { + if($("#popupWrap").length > 0){ + $("#popupWrap").hide(); + } var modal; if (el) { modal = $(el).parents('.ui-dialog-content'); @@ -1554,13 +1557,24 @@ function pop_up_box(value,tWidth,tTop,tLeft){ function pop_box_new(value, Width, Height){ w = ($(window).width() - Width)/2; h = ($(window).height() - Height)/2; - $("#ajax-modal").html(value); - showModal('ajax-modal', Width + 'px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').parent().css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed"}); - $('#ajax-modal').parent().removeClass("resourceUploadPopup popbox_polls popbox"); - $('#ajax-modal').css({"padding":"0","overflow":"hidden"}); - $('#ajax-modal').parent().attr("id","popupWrap"); + var container =$('
      '); + container.attr('id','popupWrap'); + $(document.body).append(container); + $("#popupWrap").html(value); + $("#popupWrap").show(); + $('#popupWrap').css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed","z-index":"99999","background-color":"#fff","box-shadow": "0px 2px 8px rgba(146, 153, 169, 0.5)"}); + $('#popupWrap').find("a[class*='close']").click(function(){ + $("#popupWrap").hide(); + }); +// w = ($(window).width() - Width)/2; +// h = ($(window).height() - Height)/2; +// $("#ajax-modal").html(value); +// showModal('ajax-modal', Width + 'px'); +// $('#ajax-modal').siblings().remove(); +// $('#ajax-modal').parent().css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed"}); +// $('#ajax-modal').parent().removeClass("resourceUploadPopup popbox_polls popbox"); +// $('#ajax-modal').css({"padding":"0","overflow":"hidden"}); +// $('#ajax-modal').parent().attr("id","popupWrap"); //拖拽 function Drag(id) { @@ -1576,7 +1590,7 @@ function pop_box_new(value, Width, Height){ _this.getDistance(evt); document.onmousemove = function (evt) { _this.setPosition(evt); - } + }; _this.div.onmouseup = function () { _this.clearEvent(); } @@ -1586,7 +1600,7 @@ function pop_box_new(value, Width, Height){ var oEvent = evt || event; this.disX = oEvent.clientX - this.div.offsetLeft; this.disY = oEvent.clientY - this.div.offsetTop; - } + }; Drag.prototype.setPosition = function (evt) { var oEvent = evt || event; var l = oEvent.clientX - this.disX; @@ -1605,18 +1619,24 @@ function pop_box_new(value, Width, Height){ } this.div.style.left = l + "px"; this.div.style.top = t + "px"; - } + }; Drag.prototype.clearEvent = function () { this.div.onmouseup = null; document.onmousemove = null; - } + }; - $(".sy_popup_con").mousedown(function(event){ + new Drag("popupWrap"); + + $("#popupWrap input, #popupWrap textarea").mousedown(function(event){ event.stopPropagation(); new Drag("popupWrap"); }); } +function close_modal(){ + $("#popupWrap").hide(); +} + // 公共提示弹框样式 //function pop_box_tip_new(value, Width, Top, Left){ // $("#ajax-modal").html(value); diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 71e817e9f..1945667af 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -626,7 +626,7 @@ $(function(){ //生成select function build_selector(max_num){ - var html = ""; for(var i = 0; i <= max_num; i += 10){ if( i == max_num){ html += ""; @@ -637,6 +637,18 @@ function build_selector(max_num){ html += ""; return html; } +function build_selector_sy(max_num){ + var html = ""; + return html; +} //提交匿评参数设置 function submit_set_evaluation_attr(end_time){ @@ -650,7 +662,8 @@ function submit_set_evaluation_attr(end_time){ $("#evaluation_num").focus(); } else{ - $('#popbox02 form').submit(); + $('#muban_popup_box form').submit(); + hideModal(); } } diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 314850332..916481818 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -268,7 +268,8 @@ function submit_set_evaluation_attr(end_time){ $("#evaluation_num").focus(); } else{ - $('#popbox02 form').submit(); + $('#muban_popup_box form').submit(); + hideModal(); } } diff --git a/public/javascripts/organization.js b/public/javascripts/organization.js index 7c1f3578c..726e3c449 100644 --- a/public/javascripts/organization.js +++ b/public/javascripts/organization.js @@ -50,7 +50,7 @@ function reset_topic(){ $("#evaluation_num").focus(); } else{ - $('#popbox02 form').submit(); + $('#muban_popup_box form').submit(); hideModal(); } } diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index 8a858d5f7..a2b577263 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -165,6 +165,8 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mr60 {margin-right:60px;} .mr65 {margin-right:65px;} .mr70{margin-right: 70px;} +.mr75{margin-right: 75px;} +.mr80{margin-right: 80px;} .mr95 {margin-right:95px !important;} .mr100 {margin-right:100px !important;} .mr118 {margin-right:118px !important;} @@ -229,6 +231,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .w50 {width:50px;} .w56 {width:56px;} .w60{ width:60px;} +.w61{ width:61px;} .w70{ width:70px;} .w80{ width:80px;} .w90{ width:90px;} diff --git a/public/stylesheets/css/moduel.css b/public/stylesheets/css/moduel.css index dde26fbf2..871b72c9e 100644 --- a/public/stylesheets/css/moduel.css +++ b/public/stylesheets/css/moduel.css @@ -3,7 +3,10 @@ .muban_popup_top{background:#3b94d6;height:40px;-webkit-border-radius: 5px 5px 0px 0px;-moz-border-radius: 5px 5px 0px 0px;-o-border-radius: 5px 5px 0px 0px;border-radius: 5px 5px 0px 0px;} .muban_popup_top h3{ font-size:16px; color:#fff; font-weight:normal; line-height:40px; padding-left:10px; } a.muban_icons_close{width:20px; height:20px;display:block;background: url(/images/sy/sy_icons_close.png) 0 0px no-repeat; margin:8px 10px 0 0;} -a:hover.muban_icons_close{background: url(/images/sy/sy_icons_close.png) -40px 0px no-repeat;} +a:hover.muban_icons_close{background: url(../images/sy/sy_icons_close.png) -40px 0px no-repeat;} +#muban_popup_box input,#muban_popup_box select{ border:1px solid #c8c8c8; height: 28px; color: #888;} +#muban_popup_box label.pop_box_label{width: 100px; text-align: right; display: inline-block;} +input.radio-width90{ width: 90px; } #muban_popup_box input,#muban_popup_box select{ border:1px solid #c8c8c8; height: 28px; color: #888;} #muban_popup_box label{width: 100px; text-align: right; display: inline-block;} /*模板表格 20161013byLB*/ @@ -59,3 +62,11 @@ a.sub_btn{ cursor:pointer; -moz-border-radius:3px; -webkit-border-radius:3px; b a:hover.sub_btn{ background:#b5e2fa; color:#000; border:1px solid #3c7fb1;} /*模板form 20161013byLB*/ textarea.muban_textarea{ width: 98.5%;border:1px solid #ddd; background:#fff; color:#666; padding:5px;} +/*模板图标20161020byLB*/ +.muban-icons-clock{ background: url("../images/project/icons_issue.png") 0 -224px no-repeat; display: inline-block; width: 19px; height: 13px;} +/*提示条20161020byLB*/ +.alert{ padding:10px;border: 1px solid transparent; text-align: center;} +.alert-blue{ background-color: #d9edf7;border-color: #bce8f1; color: #3a87ad;} +.alert-orange{ background-color: #fff9e9;border-color: #f6d0b1; color:#ee4a20;} +.close{padding: 0;cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; font-size: 21px; font-weight: bold;line-height: 1; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.3;} +.close:hover{opacity: 0.5;} \ No newline at end of file diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 703ca11dd..cb8e4efaf 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -780,7 +780,7 @@ a:hover.issues_list_title{color:#3b94d6;} /* 搜索 与课程相同 */ .hw_search_box{ position:relative; } -.hw_search_box input.hw_search-input{ width:293px; height:28px; border:none; border:1px solid #e7e7e7; background:#fff; padding-left:5px;} +.hw_search_box input.hw_search-input{ width:293px; height:28px; border:none; border:1px solid #e7e7e7; background:#fff; padding-left:5px;padding-right: 25px;} .hw_search_box a.hw_btn_search{display:block; width:20px; height:20px; background:url(/images/hw/icons_hw.png) 0 -57px no-repeat; position:absolute; right:5px; top:5px; cursor:pointer;} .hw_search_box a:hover.hw_btn_search{background:url(../images/hw/icons_hw.png) -40px -57px no-repeat;} .hw_files_icon{display:block; width:17px; height:14px; background:url(../images/hw/icons_hw.png) 0 -135px no-repeat;} diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index aaba81c80..c75e7f37e 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1443,8 +1443,8 @@ a.syllabusbox_a_blue { /*flex布局*/ .flex-container {display:flex;} -.flex-cell {flex:1;} -.flex-cell:last-child {text-align:right;} +.flex-cell {flex:1; text-align: center} +/*.flex-cell:last-child {text-align:right;}*/ /*新课程、项目公用样式提取*/ .sy_new_orange{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #ff4a1b;border: 1px solid #ff4a1b;} @@ -1521,7 +1521,12 @@ a.syllabusbox_a_blue{ .homepagePostContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff;} .homepageMainContent {margin: 10px auto; width: 750px;} +.pro_newsetting_con li{ line-height: 30px;} +.popup_tip_box { position: relative; padding: 5px 10px; white-space: nowrap; background-color: #FFFEF4; border:1px solid #F3DDB3;} +.popup_tip_box em { display: block; border-width: 9px; position: absolute; top: 5px; left: -18px; border-style: dashed solid dashed dashed; border-color: transparent #F3DDB3 transparent transparent; font-size: 0; line-height: 0;} +.popup_tip_box span { display: block; border-width: 9px;position: absolute; top: 5px; left: -17px; border-style: dashed solid dashed dashed;border-color: transparent #FFFEF4 transparent transparent; font-size: 0; line-height: 0; } + /*模拟title*/ .simulation-title {position:absolute; background-color:#fff; padding:5px 10px; z-index:99; white-space:nowrap; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); display:none; color:#666; border:1px solid #666; line-height:1;} /*项目创建*/ -.project_new_input {border: 1px solid #ddd;height: 20px;width: 794px;background: #fff;padding: 5px;} +.project_new_input {border: 1px solid #ddd;height: 20px;width: 794px;background: #fff;padding: 5px;} \ No newline at end of file