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)) -%> +
请输入数值0-50
+请输入数值0-50
+教师评分 - 迟交扣分 - 缺评扣分
+助教评分 * 其百分比 +
+ 学生匿评平均分 * 其百分比 -
+ ( 迟交扣分 + 缺评扣分 )
请输入数值0-50
+请输入数值0-50
+教师评分-迟交扣分-缺评扣分
+系统评分*其百分比+
+ 助教评 *其百分比+
+ 学生匿评平均分*其百分比 -
+ ( 迟交扣分+缺评扣分 )
请输入数值0-50
+教师评分 - 迟交扣分
+系统评分 * 其百分比 +
+ 助教评分 * 其百分比 -
+ 迟交扣分
由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %>
+由<%= link_to @journal.user, user_path(@journal.user), :class => "c_blue" %> 更新于 <%= format_time @journal.created_on %>
+ +<%= link_to l(:button_back), issue_path(@issue), :onclick => 'history.back(); return false;' %>
+ + <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> -<%= 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 @@+ <% 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 %>