diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d431cbfd..919e374b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,6 +33,28 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter + # 课堂相关controller + def course_controller + ["courses", "homework_common", "student_work", "exercise", "poll", "boards", "messages", "graduation_topics", "graduation_tasks", + "graduation_works", "files"] + end + + # 实训课程相关controller + def subjects_controller + ["subjects", "stages"] + end + + # 实训路径相关controller + def shixuns_controller + ["shixuns", "challenges", "myshixuns", "games"] + end + + # 工程认证相关controller + def ecs_controller + ["ecs", "ec_courses", "ec_course_evaluations", "ec_course_supports", "ec_course_targets", "ec_graduation_requirements", + "ec_major_schools", "ec_majors", "ec_years"] + end + def exercise_bank_json_data exercises exercises.map do |exercise| exercise_path = exercise_bank_path(exercise) diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 7d75daa2..314f604e 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -188,9 +188,9 @@ class HomeworkCommon < ActiveRecord::Base # end end - def is_program_homework? - self.homework_type == 2 && self.homework_detail_programing - end + # def is_program_homework? + # self.homework_type == 2 && self.homework_detail_programing + # end def is_group_homework? self.homework_type == 3 && self.homework_detail_group @@ -225,6 +225,6 @@ class HomeworkCommon < ActiveRecord::Base end end - delegate :language_name, :language, :to => :homework_detail_programing + # delegate :language_name, :language, :to => :homework_detail_programing end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 573b2cbe..7a7f5eb3 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -24,7 +24,7 @@ class StudentWork < ActiveRecord::Base scope :all_commit, lambda{where("work_status != 0")} before_destroy :delete_praise - before_save :set_program_score, :set_src + before_save :set_program_score after_save :update_avg_sum_score # after_create :act_as_message @@ -34,25 +34,26 @@ class StudentWork < ActiveRecord::Base PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all end - def last_test - student_work_tests.order('id desc').first - end + # def last_test + # student_work_tests.order('id desc').first + # end private def set_program_score - if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分 - #根据最后一次测试计算得分 - unless last_test - self.system_score = 0 - else - self.system_score = last_test.test_score self.homework_common.homework_tests.size - end - end + # if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分 + # #根据最后一次测试计算得分 + # unless last_test + # self.system_score = 0 + # else + # self.system_score = last_test.test_score self.homework_common.homework_tests.size + # end + # end set_final_score self.homework_common,self end - def set_src - self.description = last_test.src if last_test - end + + # def set_src + # self.description = last_test.src if last_test + # end #成绩计算 def set_final_score homework,student_work @@ -217,8 +218,8 @@ class StudentWork < ActiveRecord::Base # status == 0 : delay def act_as_message - if self.work_status != 0 && self.created_at > self.homework_common.end_time - self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false) - end + # if self.work_status != 0 && self.created_at > self.homework_common.end_time + # self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false) + # end end end diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 570d9f55..41fdfc64 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -2,10 +2,10 @@ <%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>