迁移课程作业数据
This commit is contained in:
parent
0d99644fa7
commit
69e366d841
|
@ -17,6 +17,12 @@ class Course < ActiveRecord::Base
|
|||
:include => :principal,
|
||||
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
|
||||
has_many :users, :through => :members
|
||||
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :homework_for_courses, :dependent => :destroy
|
||||
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||
has_many :student, :through => :students_for_courses, :source => :user
|
||||
|
||||
|
||||
validates_presence_of :password, :term
|
||||
validates_format_of :class_period, :message => "class period can only digital!", :with =>/^[1-9]\d*$/
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<%
|
||||
id = "finish_course_#{project.id}"
|
||||
display = (project.course_extra.teacher.id == User.current.id || User.current.admin?)
|
||||
id = "finish_course_#{course.id}"
|
||||
display = (course.teacher.id == User.current.id || User.current.admin?)
|
||||
%>
|
||||
|
||||
<% if display #如果课程已结束%>
|
||||
<% linkPath = course_endTime_timeout?(project) ? restartcourse_project_path(project) : finishcourse_project_path(project, format: :js) %>
|
||||
<% desc = course_endTime_timeout?(project) ? '重启' : '关闭' %>
|
||||
<% linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js) %>
|
||||
<% desc = course_endTime_timeout?(course) ? '重启' : '关闭' %>
|
||||
|
||||
<%= link_to "#{desc}课程", linkPath, :remote => true, :method => :post, :id => id, :confirm => ("确定要#{desc}课程?") %>
|
||||
<% else %>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RenameProjectIdToHomeworkForCourses < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column(:homework_for_courses, :project_id, :course_id)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue