Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
dc0180988f
|
@ -498,10 +498,10 @@ class BidsController < ApplicationController
|
||||||
#增加作业按评分排序,
|
#增加作业按评分排序,
|
||||||
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
|
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
|
||||||
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.courses.first.teacher.id}) AS t_score,
|
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score,
|
||||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.courses.first.teacher.id}) AS s_score
|
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score
|
||||||
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
|
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
|
||||||
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * 0.6 END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * 0.4 END) DESC,created_at ASC")
|
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC")
|
||||||
if params[:student_id].present?
|
if params[:student_id].present?
|
||||||
@temp = []
|
@temp = []
|
||||||
@homework_list.each do |pro|
|
@homework_list.each do |pro|
|
||||||
|
@ -788,6 +788,7 @@ class BidsController < ApplicationController
|
||||||
@bid.name = params[:bid][:name]
|
@bid.name = params[:bid][:name]
|
||||||
@bid.description = params[:bid][:description]
|
@bid.description = params[:bid][:description]
|
||||||
@bid.is_evaluation = params[:bid][:is_evaluation]
|
@bid.is_evaluation = params[:bid][:is_evaluation]
|
||||||
|
@bid.proportion = params[:bid][:proportion]
|
||||||
@bid.reward_type = 3
|
@bid.reward_type = 3
|
||||||
# @bid.budget = params[:bid][:budget]
|
# @bid.budget = params[:bid][:budget]
|
||||||
@bid.deadline = params[:bid][:deadline]
|
@bid.deadline = params[:bid][:deadline]
|
||||||
|
|
|
@ -490,6 +490,7 @@ class CoursesController < ApplicationController
|
||||||
# 新建作业
|
# 新建作业
|
||||||
def new_homework
|
def new_homework
|
||||||
@homework = Bid.new
|
@homework = Bid.new
|
||||||
|
@homework.proportion
|
||||||
@homework.safe_attributes = params[:bid]
|
@homework.safe_attributes = params[:bid]
|
||||||
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
|
|
|
@ -105,7 +105,7 @@ class SchoolController < ApplicationController
|
||||||
end
|
end
|
||||||
options = ""
|
options = ""
|
||||||
@school.each do |s|
|
@school.each do |s|
|
||||||
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
options << "<li style = 'width: 33%; float: left'> <a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
||||||
end
|
end
|
||||||
|
|
||||||
render :text => options
|
render :text => options
|
||||||
|
|
|
@ -83,6 +83,19 @@ module CoursesHelper
|
||||||
type << option2
|
type << option2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def proportion_option
|
||||||
|
type = []
|
||||||
|
i = 0
|
||||||
|
while i <= 100
|
||||||
|
option = []
|
||||||
|
option << i.to_s + "%"
|
||||||
|
option << i
|
||||||
|
type << option
|
||||||
|
i = i + 10
|
||||||
|
end
|
||||||
|
type
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
alias teacherCountOrigin teacherCount
|
alias teacherCountOrigin teacherCount
|
||||||
def teacherCount project
|
def teacherCount project
|
||||||
|
@ -308,7 +321,7 @@ module CoursesHelper
|
||||||
#最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6
|
#最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6
|
||||||
def score_for_homework homework
|
def score_for_homework homework
|
||||||
if homework.bid.is_evaluation == 1 || homework.bid.is_evaluation == nil
|
if homework.bid.is_evaluation == 1 || homework.bid.is_evaluation == nil
|
||||||
return format("%.2f",(teacher_score_for_homework(homework).to_f * 0.6 + student_score_for_homework(homework).to_f * 0.4))
|
return format("%.2f",(homework.bid.proportion * 1.0 / 100) * (teacher_score_for_homework(homework).to_f) + (1 - homework.bid.proportion * 1.0 / 100) * (student_score_for_homework(homework).to_f))
|
||||||
else
|
else
|
||||||
return teacher_score_for_homework homework
|
return teacher_score_for_homework homework
|
||||||
end
|
end
|
||||||
|
@ -332,7 +345,7 @@ module CoursesHelper
|
||||||
return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars)
|
return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars)
|
||||||
end
|
end
|
||||||
|
|
||||||
#获取指定作业的得分
|
#获取指定项目的得分
|
||||||
def project_score project
|
def project_score project
|
||||||
issue_count = project.issues.count
|
issue_count = project.issues.count
|
||||||
issue_journal_count = project.issue_changes.count
|
issue_journal_count = project.issue_changes.count
|
||||||
|
|
|
@ -113,6 +113,7 @@ class Project < ActiveRecord::Base
|
||||||
|
|
||||||
validates_presence_of :name, :identifier
|
validates_presence_of :name, :identifier
|
||||||
validates_uniqueness_of :identifier
|
validates_uniqueness_of :identifier
|
||||||
|
validates_uniqueness_of :name
|
||||||
validates_associated :repository, :wiki
|
validates_associated :repository, :wiki
|
||||||
# validates_length_of :description, :maximum => 255
|
# validates_length_of :description, :maximum => 255
|
||||||
validates_length_of :name, :maximum => 255
|
validates_length_of :name, :maximum => 255
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
</p>
|
</p>
|
||||||
<p><%= f.select :is_evaluation, is_evaluation_option %>
|
<p><%= f.select :is_evaluation, is_evaluation_option %>
|
||||||
</p>
|
</p>
|
||||||
|
<p><%= f.select :proportion, proportion_option %>
|
||||||
|
</p>
|
||||||
<p><%= hidden_field_tag 'course_id', @course.id %>
|
<p><%= hidden_field_tag 'course_id', @course.id %>
|
||||||
</p>
|
</p>
|
||||||
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
|
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p>
|
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p>
|
||||||
|
|
||||||
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p><!--by young-->
|
<p style="margin-left:-10px;padding-right: 20px;">
|
||||||
|
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||||
|
</p><!--by young-->
|
||||||
<p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
|
<p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
|
||||||
<% unless @project.identifier_frozen? %>
|
<% unless @project.identifier_frozen? %>
|
||||||
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
|
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
|
||||||
|
@ -24,44 +26,44 @@
|
||||||
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>
|
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>
|
||||||
|
|
||||||
|
|
||||||
<!-- <% if @project.new_record? %>
|
<!-- <%# if @project.new_record? %>
|
||||||
<fieldset class="box tabular"><legend><%= l(:label_module_plural) %></legend>
|
<fieldset class="box tabular"><legend><%#= l(:label_module_plural) %></legend>
|
||||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
<%# Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||||
<label class="floating">
|
<label class="floating">
|
||||||
<%= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %>
|
<%#= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %>
|
||||||
<%= l_or_humanize(m, :prefix => "project_module_") %>
|
<%#= l_or_humanize(m, :prefix => "project_module_") %>
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<%= hidden_field_tag 'project[enabled_module_names][]', '' %>
|
<%#= hidden_field_tag 'project[enabled_module_names][]', '' %>
|
||||||
<%= javascript_tag 'observeProjectModules()' %>
|
<%#= javascript_tag 'observeProjectModules()' %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% end %>
|
<%# end %>
|
||||||
|
|
||||||
<% if @project.new_record? || @project.module_enabled?('issue_tracking') %>
|
<%# if @project.new_record? || @project.module_enabled?('issue_tracking') %>
|
||||||
<% unless @trackers.empty? %>
|
<%# unless @trackers.empty? %>
|
||||||
<fieldset class="box tabular" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend>
|
<fieldset class="box tabular" id="project_trackers"><legend><%#=l(:label_tracker_plural)%></legend>
|
||||||
<% @trackers.each do |tracker| %>
|
<%# @trackers.each do |tracker| %>
|
||||||
<label class="floating">
|
<label class="floating">
|
||||||
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
|
<%#= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
|
||||||
<%=h tracker %>
|
<%#=h tracker %>
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<%= hidden_field_tag 'project[tracker_ids][]', '' %>
|
<%#= hidden_field_tag 'project[tracker_ids][]', '' %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% end %>
|
<%# end %>
|
||||||
|
|
||||||
<% unless @issue_custom_fields.empty? %>
|
<%# unless @issue_custom_fields.empty? %>
|
||||||
<fieldset class="box tabular" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%></legend>
|
<fieldset class="box tabular" id="project_issue_custom_fields"><legend><%#=l(:label_custom_field_plural)%></legend>
|
||||||
<% @issue_custom_fields.each do |custom_field| %>
|
<%# @issue_custom_fields.each do |custom_field| %>
|
||||||
<label class="floating">
|
<label class="floating">
|
||||||
<%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
|
<%#= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
|
||||||
<%=h custom_field.name %>
|
<%#=h custom_field.name %>
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
|
<%#= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<% end %> -->
|
<%# end %> -->
|
||||||
<!--[eoform:project]-->
|
<!--[eoform:project]-->
|
||||||
|
|
||||||
<% unless @project.identifier_frozen? %>
|
<% unless @project.identifier_frozen? %>
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function test(id){
|
function test(id){
|
||||||
|
location.href = encodeURI('/course/'+id);
|
||||||
location.href = encodeURI('http://course.trustie.net<%=port%>?school_id='+id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function ssearch(){
|
function ssearch(){
|
||||||
|
@ -69,8 +69,9 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
<a href="http://course.trustie.net<%=port%>?school_id=0">全部学校</a>
|
|
||||||
<a href="http://course.trustie.net<%=port%>">我的学校</a>
|
<%= link_to "全部学校",school_index_path %>
|
||||||
|
<%= link_to '我的学校',school_course_list_path(User.current.user_extensions.school) %>
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li style="width: 40%; float: left">请选择省份:
|
<li style="width: 40%; float: left">请选择省份:
|
||||||
|
@ -84,7 +85,7 @@
|
||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
<div>
|
<div>
|
||||||
<ul id="schoollist" style="line-height: 25px">
|
<ul id="schoollist" style="line-height: 25px">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1574,6 +1574,7 @@ zh:
|
||||||
field_budget: 奖励
|
field_budget: 奖励
|
||||||
field_deadline: 截止日期
|
field_deadline: 截止日期
|
||||||
field_is_evaluation: 是否启动互评
|
field_is_evaluation: 是否启动互评
|
||||||
|
field_proportion: 教师评分比例
|
||||||
label_tags_selected: 已选标签
|
label_tags_selected: 已选标签
|
||||||
label_tags_related: 相关标签
|
label_tags_related: 相关标签
|
||||||
button_project_tags_add: 增加
|
button_project_tags_add: 增加
|
||||||
|
|
|
@ -700,8 +700,8 @@ RedmineApp::Application.routes.draw do
|
||||||
#######confusing########
|
#######confusing########
|
||||||
get 'welcome/search', to: 'welcome#search'
|
get 'welcome/search', to: 'welcome#search'
|
||||||
get 'school/index', to: 'school#index'
|
get 'school/index', to: 'school#index'
|
||||||
get 'course/:school_id', to: 'welcome#course'
|
get 'course/:school_id', to: 'welcome#course', :as => 'school_course_list'
|
||||||
get 'course/:school_id', to: 'welcome#course'
|
#get 'course/:school_id', to: 'welcome#course'
|
||||||
post 'school/get_options/:province', :to => 'school#get_options'
|
post 'school/get_options/:province', :to => 'school#get_options'
|
||||||
get 'school/get_options/:province', :to => 'school#get_options'
|
get 'school/get_options/:province', :to => 'school#get_options'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddProportionToBid < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :bids, :proportion, :integer, default: 60
|
||||||
|
end
|
||||||
|
end
|
|
@ -94,18 +94,19 @@ ActiveRecord::Schema.define(:version => 20140703085204) do
|
||||||
|
|
||||||
create_table "bids", :force => true do |t|
|
create_table "bids", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "budget", :null => false
|
t.string "budget", :null => false
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.date "deadline"
|
t.date "deadline"
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", :null => false
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_on", :null => false
|
||||||
t.integer "commit"
|
t.integer "commit"
|
||||||
t.integer "reward_type"
|
t.integer "reward_type"
|
||||||
t.integer "homework_type"
|
t.integer "homework_type"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
t.string "password"
|
t.string "password"
|
||||||
t.integer "is_evaluation"
|
t.integer "is_evaluation"
|
||||||
|
t.integer "proportion", :default => 60
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "boards", :force => true do |t|
|
create_table "boards", :force => true do |t|
|
||||||
|
@ -793,7 +794,7 @@ ActiveRecord::Schema.define(:version => 20140703085204) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "relative_memos", :force => true do |t|
|
create_table "relative_memos", :force => true do |t|
|
||||||
t.integer "osp_id"
|
t.integer "osp_id", :null => false
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
t.string "subject", :null => false
|
t.string "subject", :null => false
|
||||||
t.text "content", :null => false
|
t.text "content", :null => false
|
||||||
|
|
Binary file not shown.
Binary file not shown.
BIN
doc/测试环境搭建.doc
BIN
doc/测试环境搭建.doc
Binary file not shown.
Loading…
Reference in New Issue