diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index a301a1e6c..ee953e913 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -514,6 +514,8 @@ private end def has_login - render_403 unless User.current.logged? + unless @attachment && @attachment.container_type == "PhoneAppVersion" + render_403 unless User.current.logged? + end end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a0a61786c..a1c7ae875 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -20,11 +20,10 @@ class CoursesController < ApplicationController menu_item l(:label_sort_by_influence), :only => :index before_filter :can_show_course, :except => [] - before_filter :logged_user_by_apptoken,:only => [:show,:new_homework,:feedback] - before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_private_courses] - before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course] - before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create] - before_filter :require_admin, :only => [:copy, :archive, :unarchive, :destroy, :calendar] + before_filter :logged_user_by_apptoken,:only => [:show,:feedback] + before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses] + before_filter :authorize_course, :only => [:show, :settings, :update, :course] + before_filter :authorize_course_global, :only => [:new,:create] before_filter :toggleCourse, :only => [:finishcourse, :restartcourse] before_filter :require_login, :only => [:join, :unjoin] @@ -605,7 +604,7 @@ class CoursesController < ApplicationController def toggleCourse @course_prefs = Course.find_by_extra(@course.extra) - unless (@course_prefs.teacher == User.current || User.current.admin?) + unless (@course_prefs.student != User.current || User.current.admin?) render_403 end end @@ -809,6 +808,12 @@ class CoursesController < ApplicationController end end + #删除课程 + #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 + def destroy + + end + private def allow_join course if course_endTime_timeout? course diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6e6fa7d20..4b655cf31 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -18,9 +18,31 @@ class HomeworkCommonController < ApplicationController end def new - respond_to do |format| - format.html - end + # @homework_type = "1" + # + # @homework = HomeworkCommon.new + # @homework.safe_attributes = params[:homework_common] + # @homework.late_penalty = 0 + # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.publish_time = Time.now.strftime('%Y-%m-%d') + # + # if @homework_type == "1" + # #匿评作业相关属性 + # @homework_detail_manual = HomeworkDetailManual.new + # @homework_detail_manual.ta_proportion = 0.6 + # @homework_detail_manual.absence_penalty = 0 + # @homework_detail_manual.evaluation_num = 3 + # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.homework_detail_manual = @homework_detail_manual + # elsif @homework_type == "2" + # #编程作业相关属性 + # @homework_detail_programing = HomeworkDetailPrograming.new + # @homework.homework_detail_programing = @homework_detail_programing + # end + # respond_to do |format| + # format.html + # end end #新建作业下一步 @@ -71,9 +93,9 @@ class HomeworkCommonController < ApplicationController if homework.homework_type == 2 homework_detail_programing = HomeworkDetailPrograming.new - homework_detail_programing.language = "C++" + homework_detail_programing.language = params[:language] homework_detail_programing.standard_code = params[:standard_code] - + homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 question = {title:homework.name,content:homework.description} question[:input] = [] question[:output] = [] @@ -187,8 +209,9 @@ class HomeworkCommonController < ApplicationController end if @homework.homework_type == 2 && @homework_detail_programing #编程作业 - @homework_detail_programing.language = "C++" + @homework_detail_programing.language = params[:language] @homework_detail_programing.standard_code = params[:standard_code] + @homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 homework_tests = @homework.homework_tests #需要删除的测试 ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) @@ -213,6 +236,25 @@ class HomeworkCommonController < ApplicationController end end end + + #发送修改作业的请求 + question = {title:@homework.name,content:@homework.description} + question[:input] = [] + question[:output] = [] + @homework.homework_tests.each do |test| + question[:input] << test.input + question[:output] << test.output + end + uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json") + body = question.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Put.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + result = JSON.parse(res.body) + homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 end @homework.save_attachments(params[:attachments]) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 56b4a30fc..9385c73ee 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -73,8 +73,14 @@ class NewsController < ApplicationController @news_count = scope.count #@news_pages = Paginator.new @news_count, @limit, params['page'] #@offset ||= scope_page.offset - scope_order = scope.all(:include => [:author, :course], - :order => "#{News.table_name}.created_on DESC") + if params[:subject].nil? + scope_order = scope.all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + else + scope_order = scope.where("news.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + end + # :offset => @offset, # :limit => @limit) @newss = paginateHelper scope_order,10 @@ -83,6 +89,7 @@ class NewsController < ApplicationController @news = News.new render :layout => 'base_courses' } + format.js format.api format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end @@ -141,7 +148,7 @@ class NewsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS end - # ض̬ļ¼add start + # ������ض�̬�ļ�¼add start teachers = searchTeacherAndAssistant(@course) for teacher in teachers if(teacher.user_id != User.current.id) @@ -155,7 +162,7 @@ class NewsController < ApplicationController notify.save() end end - # ض̬ļ¼add end + # ������ض�̬�ļ�¼add end render_attachment_warning_if_needed(@news) flash[:notice] = l(:notice_successful_create) redirect_to course_news_index_url(@course) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9ddc513cd..2efaf591a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -362,13 +362,33 @@ class ProjectsController < ApplicationController end # dts测试工具 - def dts_rep + def dts_dep render_403 unless User.current.admin? @dts = Dts.all end # dts云部署 - def dts_yun + def yun_dep + render_403 unless User.current.admin? + end + + # 软件知识库 + def soft_knowledge + render_403 unless User.current.admin? + end + + # 在线开发平台 + def online_dev + render_403 unless User.current.admin? + end + + # 软件资源库 + def soft_file + render_403 unless User.current.admin? + end + + # 软件服务 + def soft_service render_403 unless User.current.admin? end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index b335e1830..f5fa007a5 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -484,7 +484,18 @@ update if params[:repository_id].present? @repository = @project.repositories.find_by_identifier_param(params[:repository_id]) else - @repository = @project.repository + # 多版本库,如果一个版本库为空则去下一个 + rep_count = @project.repositories.count + if @project.repository.nil? + for i in 0..rep_count + unless @project.repositories[i].nil? + @repository = @project.repositories[i] + break + end + end + else + @repository = @project.repository + end end (render_404; return false) unless @repository @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dae0bcab6..3e1e0ba29 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -128,7 +128,7 @@ class StudentWorkController < ApplicationController solutions = { student_work_id:stundet_work.id, src:Base64.encode64(stundet_work.description), - language:1 + language:@homework.homework_detail_programing.language } uri = URI(url) body = solutions.to_json @@ -157,7 +157,7 @@ class StudentWorkController < ApplicationController end def edit - if @homework.homework_type == 2 #编程作业不能修改作业 + if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业 render_403 else respond_to do |format| @@ -396,6 +396,7 @@ class StudentWorkController < ApplicationController if student_work_test.result == 0 student_score_count += 1 end + student_work_test.error_msg = params[:compile_error_msg] student_work_test.save! end end @@ -444,7 +445,7 @@ class StudentWorkController < ApplicationController #判断是不是当前作品的提交者 #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 def author_of_work - render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) + render_403 unless User.current.admin? || (User.current.id == @work.user_id && @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) end def teacher_of_course @@ -467,22 +468,60 @@ class StudentWorkController < ApplicationController sheet1 = book.create_worksheet :name => "homework" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), - l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) - count_row = 1 - items.each do |homework| - sheet1[count_row,0]=homework.user.id - sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s - sheet1[count_row,2] = homework.user.login - sheet1[count_row,3] = homework.user.user_extensions.student_id - sheet1[count_row,4] = homework.user.mail - sheet1[count_row,5] = homework.name - sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) - sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) - sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) - sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) - sheet1[count_row,10] = format_time(homework.created_at) - count_row += 1 + if @homework.homework_type == 0 #普通作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + # sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,8] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,9] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 1 #匿评作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 2 #编程作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end end book.write xls_report xls_report.string diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d6597f3da..fa5ce8405 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -448,7 +448,7 @@ class UsersController < ApplicationController def user_courses4show query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") - query = query.where("m.user_id = ?",@user.id) + query = query.where("m.user_id = ?",@user.id).order("#{Course.table_name}.id desc") if User.current == @user #看自己 else if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 @@ -456,13 +456,12 @@ class UsersController < ApplicationController query = query.where("r.role_id in(3,7,9)") end query = query.where(Course.table_name+".is_public = 1") - # or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) end if params[:lastid]!=nil && !params[:lastid].empty? - query = query.where("( (#{Course.table_name}.updated_at=? and #{Course.table_name}.id < ?) or #{Course.table_name}.updated_atnil end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 64a478187..165e22071 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1824,7 +1824,9 @@ module ApplicationHelper def attachment_candown attachment candown = false if attachment.container - if attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project + if attachment.container.class.to_s=="PhoneAppVersion" + candown = true + elsif attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project project = attachment.container.project candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1) elsif attachment.container.is_a?(Project) @@ -1850,6 +1852,7 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="StudentWork" candown = true + elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses course = attachment.container.courses.first candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index 81f817ee9..49384cca4 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -27,6 +27,19 @@ module HomeworkCommonHelper type end + def programing_languages_options + type = [] + option = [] + option << "C" + option << 1 + type << option + option_1 = [] + option_1 << "C++" + option_1 << 2 + type << option_1 + type + end + #缺评扣分 def absence_penalty_option type = [] diff --git a/app/helpers/praise_tread_helper.rb b/app/helpers/praise_tread_helper.rb index 90ce6d61d..c142f0973 100644 --- a/app/helpers/praise_tread_helper.rb +++ b/app/helpers/praise_tread_helper.rb @@ -20,9 +20,9 @@ module PraiseTreadHelper # when 0 # return @record.tread_num.nil? ? 0 : @record.tread_num # end - return (@record.praise_num.to_i-@record.tread_num.to_i) + return ((@record.praise_num.nil? ? 0 : @record.praise_num.to_i)-(@record.tread_num.nil? ? 0 : @record.tread_num.to_i)) else - return 0 + return 0 end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index d4f9e4eb8..0b2d74ee8 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -328,73 +328,41 @@ module UsersHelper return [0,[]] end list = query.order("updated_on desc").limit(10).all - return [count,list]; + return [count,list] end def get_create_course_count(user) - return Course.where("tea_id = ?",user.id).count() + if user == User.current + user.courses.count + else + user.courses.where("is_public = 1").count + end end def get_join_course_count(user) - return user.coursememberships.count() - get_create_course_count(user) + user.coursememberships.count - get_create_course_count(user) end def get_homework_commons_count(user) - return HomeworkCommon.where("user_id = ?",user.id).count() + HomeworkCommon.where("user_id = ?",user.id).count end def get_projectandcourse_attachment_count(user) - return Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count() + Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count end def get_create_project_count(user) - return Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count() + Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count end def get_join_project_count(user) - return user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) + user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) end def get_create_issue_count(user) - return Issue.where("author_id = ?",user.id).count() + Issue.where("author_id = ?",user.id).count end def get_resolve_issue_count(user) - return Issue.where("assigned_to_id = ? and status_id=3",user.id).count() + Issue.where("assigned_to_id = ? and status_id=3",user.id).count end def get_anonymous_evaluation_count(user) - return StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count() + StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count end - - # def query_activities(query,type) - # query_rec_count = 8 - # # query = query.where("act_type='JournalsForMessage'") - # #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll']) - # list = query.order("id desc").limit(query_rec_count).all - # - # result = []; - # for item in list - # container = get_activity_container(item,type) - # if( activity_is_show(item,container) ) - # result << { :item=>item,:e=>container } - # end - # end - # return [lastid,result] - # end - # def get_activity_container activity,type - # e = nil; - # if type == 'Project' - # if activity.act_type == 'Poll' - # # 项目没有问卷 - # # e = Project.find_by_id(activity.act.polls_group_id) - # else - # e = activity.act.project if activity.act.respond_to?('project') - # end - # end - # if type == 'Course' - # if activity.act_type == 'Poll' - # e = Course.find_by_id(activity.act.polls_group_id) - # else - # e = activity.act.course if activity.act.respond_to?('course') - # end - # end - # - # return e; - # end def query_activities(query) list = query.limit(8).all result = []; @@ -406,31 +374,8 @@ module UsersHelper end def get_activity_container activity return activity.activity_container - # if type == 'Project' - # return activity.act.project if activity.act.respond_to?('project') - # end - # if type == 'Course' - # if activity.act_type == 'Poll' - # return Course.find_by_id(activity.act.polls_group_id) - # end - # return activity.act.course if activity.act.respond_to?('course') - # end - # return nil; end - # def activity_is_show(activity,e) - # if(!e) - # return false - # end - # - # if activity.user_id == User.current.id - # return true - # end - # if( e.visible? ) - # return true - # end - # return false - # end def get_activity_act_showname_htmlclear(activity) str = get_activity_act_showname(activity) str = str.gsub(/<.*>/,'') diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb index 7c477bfaf..4ed290ecd 100644 --- a/app/models/homework_test.rb +++ b/app/models/homework_test.rb @@ -2,5 +2,5 @@ class HomeworkTest < ActiveRecord::Base attr_accessible :input, :output, :homework_common_id belongs_to :homework_common - has_one :student_work_test + has_many :student_work_test end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index c80d1315b..b95c11c11 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -7,7 +7,7 @@ class StudentWork < ActiveRecord::Base has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy belongs_to :project - has_one :student_work_test + has_many :student_work_test before_destroy :delete_praise diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index d9ac5e935..413528b82 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -1,12 +1,12 @@ # encoding: utf-8 class StudentWorkTest < ActiveRecord::Base - attr_accessible :student_work_id, :homework_test_id + attr_accessible :student_work_id, :homework_test_id, :result, :error_msg belongs_to :homework_test belongs_to :student_work def status_to_s - case self.result + case self.result.to_i when -1 '编译出错' when -2 @@ -33,7 +33,7 @@ class StudentWorkTest < ActiveRecord::Base end def test_score - if self.result == 0 + if self.result.to_i == 0 format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) else 0 diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index e8eebe00d..35d9fe399 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -63,7 +63,7 @@ :member_id => member.id, :remote => true}, :class => 'ml258 c_red' %> - <%= format_date(member.created_on)%> + <%= format_date(member.created_on)%> <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index e27fb5b9e..be08dd107 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -56,9 +56,7 @@