parent
872357cdf4
commit
efb6c1fd19
|
@ -77,6 +77,7 @@ class HomeworkAttachController < ApplicationController
|
||||||
if bid.homeworks.where("user_id = ?",User.current).count == 0
|
if bid.homeworks.where("user_id = ?",User.current).count == 0
|
||||||
user_id = params[:user_id]
|
user_id = params[:user_id]
|
||||||
bid_id = params[:bid_id]
|
bid_id = params[:bid_id]
|
||||||
|
project_id = params[:new_form][:project_id]
|
||||||
sta = 0
|
sta = 0
|
||||||
name = params[:new_form][:name]
|
name = params[:new_form][:name]
|
||||||
description = params[:new_form][:description]
|
description = params[:new_form][:description]
|
||||||
|
@ -85,7 +86,8 @@ class HomeworkAttachController < ApplicationController
|
||||||
:state => sta,
|
:state => sta,
|
||||||
:name => name,
|
:name => name,
|
||||||
:description => description,
|
:description => description,
|
||||||
:bid_id => bid_id
|
:bid_id => bid_id,
|
||||||
|
:project_id => project_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ class HomeworkAttach < ActiveRecord::Base
|
||||||
has_many :homework_users, :dependent => :destroy
|
has_many :homework_users, :dependent => :destroy
|
||||||
has_many :users, :through => :homework_users
|
has_many :users, :through => :homework_users
|
||||||
seems_rateable :allow_update => true, :dimensions => :quality
|
seems_rateable :allow_update => true, :dimensions => :quality
|
||||||
|
belongs_to :project
|
||||||
|
|
||||||
safe_attributes "bid_id",
|
safe_attributes "bid_id",
|
||||||
"user_id"
|
"user_id"
|
||||||
|
@ -30,7 +31,7 @@ class HomeworkAttach < ActiveRecord::Base
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def project
|
def project_for_homework
|
||||||
work = HomeworkForCourse.find_by_bid_id(self.bid_id)
|
work = HomeworkForCourse.find_by_bid_id(self.bid_id)
|
||||||
if work
|
if work
|
||||||
work.project
|
work.project
|
||||||
|
|
|
@ -30,6 +30,7 @@ class Project < ActiveRecord::Base
|
||||||
|
|
||||||
# Specific overidden Activities
|
# Specific overidden Activities
|
||||||
|
|
||||||
|
belongs_to :homework_attach
|
||||||
has_many :time_entry_activities
|
has_many :time_entry_activities
|
||||||
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||||
has_many :memberships, :class_name => 'Member'
|
has_many :memberships, :class_name => 'Member'
|
||||||
|
|
|
@ -46,9 +46,10 @@
|
||||||
<%= f.text_field :name, :required => true, :name => "homework_name", :size => 60, :style => "width:490px;"%>
|
<%= f.text_field :name, :required => true, :name => "homework_name", :size => 60, :style => "width:490px;"%>
|
||||||
</p>
|
</p>
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<strong>关联项目:</strong>
|
<strong>提交项目:</strong>
|
||||||
<%= f.select :project_id, options_for_select(user_projects_option),:name => "project_id", :required => true%>
|
<%= f.select :project_id, options_for_select(user_projects_option,@homework.project.id),:name => "project_id", :required => true%>
|
||||||
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target => '_blank' %>
|
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target => '_blank' %>
|
||||||
|
<p class="font_lighter" style="padding-left:120px;clear:left;">提交项目可以为空</p>
|
||||||
</p>
|
</p>
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<strong style="vertical-align: top">描 述:</strong>
|
<strong style="vertical-align: top">描 述:</strong>
|
||||||
|
|
|
@ -26,6 +26,12 @@
|
||||||
<strong>标 题:</strong>
|
<strong>标 题:</strong>
|
||||||
<%= f.text_field "name", :required => true, :size => 60, :style => "width:490px;" %>
|
<%= f.text_field "name", :required => true, :size => 60, :style => "width:490px;" %>
|
||||||
</p>
|
</p>
|
||||||
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
|
<strong>提交项目:</strong>
|
||||||
|
<%= f.select :project_id, options_for_select(user_projects_option),:name => "project_id", :required => true%>
|
||||||
|
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target => '_blank' %>
|
||||||
|
<p class="font_lighter" style="padding-left:120px;clear:left;">提交项目可以为空</p>
|
||||||
|
</p>
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<strong style="vertical-align: top">描 述:</strong>
|
<strong style="vertical-align: top">描 述:</strong>
|
||||||
<span style="margin-left:-10px;padding-right: 20px;">
|
<span style="margin-left:-10px;padding-right: 20px;">
|
||||||
|
|
12
db/schema.rb
12
db/schema.rb
|
@ -961,11 +961,13 @@ ActiveRecord::Schema.define(:version => 20140617092219) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "user_scores", :force => true do |t|
|
create_table "user_scores", :force => true do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id", :null => false
|
||||||
t.integer "collaboration"
|
t.integer "collaboration"
|
||||||
t.integer "influence"
|
t.integer "influence"
|
||||||
t.integer "skill"
|
t.integer "skill"
|
||||||
t.integer "activity"
|
t.integer "active"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "user_statuses", :force => true do |t|
|
create_table "user_statuses", :force => true do |t|
|
||||||
|
|
Loading…
Reference in New Issue