diff --git a/app/models/course.rb b/app/models/course.rb index ceced2301..b828af0ce 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -34,7 +34,7 @@ class Course < ActiveRecord::Base :delete_permission => :manage_files validates_presence_of :password, :term - validates_format_of :class_period, :message => "class period can only digital!", :with =>/^[1-9]\d*$/ + validates_format_of :class_period, :message => l(:error_class_period_only_num), :with =>/^[1-9]\d*$/ after_save :create_board_sync before_destroy :delete_all_members diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 2601d7c7e..ac5cc104d 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -66,7 +66,6 @@ <%= link_to @course.name,course_path(@course) %> - <%= @course.name %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 4e2ba0781..4c177b58e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -186,6 +186,7 @@ en: notice_account_deleted: "Your account has been permanently deleted." notice_user_successful_create: "User %{id} created." + error_class_period_only_num: "class period can only digital" error_can_t_load_default_data: "Default configuration could not be loaded: %{value}" error_scm_not_found: "The entry or revision was not found in the repository." error_scm_command_failed: "An error occurred when trying to access the repository: %{value}" diff --git a/config/locales/zh.yml b/config/locales/zh.yml index cd3e83b38..71972a6fd 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -196,6 +196,7 @@ zh: error_complete_occupation: "请您填写工作单位,否则本系统的部分功能将无法正常使用。" + error_class_period_only_num: "课程学时只能为数字" error_can_t_load_default_data: "无法载入默认设置:%{value}" error_scm_not_found: "版本库中不存在该条目和(或)其修订版本。" error_scm_command_failed: "访问版本库时发生错误:%{value}" diff --git a/db/migrate/20140618105213_migrate_course_students.rb b/db/migrate/20140618105213_migrate_course_students.rb index b9ac66714..ef037682a 100644 --- a/db/migrate/20140618105213_migrate_course_students.rb +++ b/db/migrate/20140618105213_migrate_course_students.rb @@ -3,7 +3,7 @@ class MigrateCourseStudents < ActiveRecord::Migration # 原课程的学生数据迁移成新模式 StudentsForCourse.all.each do |student| project = Project.find_by_id(student.course_id) - if project + if project && project.course_extra student.course_id = project.course_extra.id student.save end diff --git a/lib/redmine/activity/fetcher.rb b/lib/redmine/activity/fetcher.rb index 6a1b88b59..b95ae2bc3 100644 --- a/lib/redmine/activity/fetcher.rb +++ b/lib/redmine/activity/fetcher.rb @@ -102,16 +102,18 @@ module Redmine @options[:limit] = options[:limit] @scope.each do |event_type| constantized_providers(event_type).each do |provider| - if event_type.to_s != 'course_journals_for_messages' - cur_objs = provider.find_events1(event_type, @user, from, to, @options) - end - cur_objs.each do |cur_obj| - if cur_obj.class == Issue - if cur_obj.project != nil && cur_obj.project.project_status != nil + if event_type.to_s != 'course_journals_for_messages' + cur_objs = provider.find_events1(event_type, @user, from, to, @options) + end + if cur_objs + cur_objs.each do |cur_obj| + if cur_obj.class == Issue + if cur_obj.project != nil && cur_obj.project.project_status != nil + e += [cur_obj] + end + else e += [cur_obj] end - else - e += [cur_obj] end end end