Merge remote-tracking branch 'remotes/origin/szzh' into develop
This commit is contained in:
commit
2a8929b90f
|
@ -1,4 +1,4 @@
|
|||
patch:
|
||||
patch:
|
||||
用户姓名的部分,根据issues#655。
|
||||
为了修改方便
|
||||
alias:
|
||||
|
@ -66,3 +66,7 @@ bundle exec rake db:migrate:up VERSION=20140410021724
|
|||
3 运行migrate
|
||||
3 打开admin配置插件(http://127.0.0.1:3000/settings/plugin/redmine_ckeditor)
|
||||
4 点击“查询”(就是确定的功能)
|
||||
===============================================================================
|
||||
0719:若遇到首页定制报错问题请尝试如下操作
|
||||
1.运行 bundle exec rake db:migrate:down version=20140719080032
|
||||
2.运行 bundle exec rake db:migrate:up version=20140719080032
|
|
@ -357,26 +357,44 @@ module CoursesHelper
|
|||
|
||||
#获取作业的互评得分
|
||||
def student_score_for_homework homework
|
||||
member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
|
||||
if member.nil?
|
||||
return "0.00"
|
||||
#member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
|
||||
#if member.nil?
|
||||
# return "0.00"
|
||||
#end
|
||||
#student_stars = homework.rates(:quality).where("rater_id <> #{member.user_id}").select("stars")
|
||||
members = searchStudent(homework.bid.courses.first)
|
||||
user_ids = []
|
||||
members.each do |user|
|
||||
user_ids << user.user_id
|
||||
end
|
||||
student_stars = homework.rates(:quality).where("rater_id <> #{member.user_id}").select("stars")
|
||||
student_stars = homework.rates(:quality).where("rater_id in (:user_ids)",{:user_ids => user_ids}).select("stars")
|
||||
student_stars_count = 0
|
||||
student_stars.each do |star|
|
||||
student_stars_count = student_stars_count + star.stars
|
||||
end
|
||||
return format("%.2f",student_stars_count / (student_stars.count == 0 ? 1 : student_stars.count))
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
#获取作业的教师评分
|
||||
#多个教师只获取一份教师评分
|
||||
def teacher_score_for_homework homework
|
||||
member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
|
||||
if member.nil?
|
||||
return "0.00"
|
||||
members = searchTeacherAndAssistant(homework.bid.courses.first)#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
|
||||
#if member.nil?
|
||||
# return "0.00"
|
||||
#end
|
||||
teacher_ids = []
|
||||
members.each do |user|
|
||||
teacher_ids << user.user_id
|
||||
end
|
||||
teacher_stars = homework.rates(:quality).where("rater_id = #{member.user_id}").select("stars").first
|
||||
return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars)
|
||||
teacher_stars = homework.rates(:quality).where("rater_id in (:teacher_ids)",{:teacher_ids => teacher_ids}).select("stars")
|
||||
teacher_stars_count = 0
|
||||
teacher_stars.each do |star|
|
||||
teacher_stars_count = teacher_stars_count + star.stars
|
||||
end
|
||||
return format("%.2f",teacher_stars_count)
|
||||
end
|
||||
|
||||
#获取指定项目的得分
|
||||
|
|
|
@ -34,7 +34,7 @@ class Course < ActiveRecord::Base
|
|||
acts_as_attachable :view_permission => :view_files,
|
||||
:delete_permission => :manage_files
|
||||
|
||||
validates_presence_of :password, :term,:name
|
||||
validates_presence_of :password, :term,:name ,:class_period
|
||||
validates_format_of :class_period, :with =>/^\d*$/
|
||||
#validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
|
||||
|
||||
|
|
|
@ -117,9 +117,9 @@
|
|||
</td>
|
||||
<td>
|
||||
<strong>互评得分:
|
||||
<% student_homework_score = student_score_for_homework(homework) %>
|
||||
<span style="color:<%= student_homework_score == "0.00"? "#727272" : "#EC6300"%>;">
|
||||
<% score = student_homework_score == "0.00"? "N/A" : student_homework_score %>
|
||||
<%# student_homework_score = student_score_for_homework(homework) %>
|
||||
<span style="color:<%= homework.s_score.nil? ? "#727272" : "#EC6300"%>;">
|
||||
<% score = homework.s_score.nil? ? "N/A" : format("%.2f",homework.s_score) %>
|
||||
<%= score %>
|
||||
</span>
|
||||
<% if is_evaluation && is_student && (!users_for_homework(homework).include? User.current)%>
|
||||
|
@ -136,7 +136,8 @@
|
|||
</td>
|
||||
<td>
|
||||
<strong>终评得分:
|
||||
<% totle_homework_score = score_for_homework(homework) %>
|
||||
<%# totle_homework_score = score_for_homework(homework) %>
|
||||
<% totle_homework_score = format("%.2f",(homework.t_score.nil? ? 0.00 : homework.t_score) * (@bid.proportion * 1.0 / 100) + (homework.s_score.nil? ? 0.00 : homework.s_score) * (1 - @bid.proportion * 1.0 / 100)) %>
|
||||
<span style="color:<%= totle_homework_score == "0.00"? "#727272" : "#EC6300"%> ;">
|
||||
<% score = totle_homework_score == "0.00"? "N/A" : totle_homework_score %>
|
||||
<%= score %>
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_deposit_project) %>:</span>
|
||||
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %></span>
|
||||
<span><%= link_to l(:label_create_new_projects), new_project_path(course: 0, project_type: 0), :target => '_blank' %></span>
|
||||
<span><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %></span><!-- new_project_path(course: 0, project_type: 0) -->
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
<% @nav_dispaly_course_all_label = 1
|
||||
@nav_dispaly_forum_label = 1
|
||||
@nav_dispaly_course_label = nil
|
||||
@nav_dispaly_store_all_label = 1 %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||||
<% end %>
|
||||
|
|
|
@ -38,7 +38,10 @@
|
|||
<% end -%>
|
||||
<ul class="list-group-item-meta">
|
||||
<div class="issue-list-description">
|
||||
<%= l(:field_description)%>: <%= issue.short_description %>
|
||||
<div class="wiki">
|
||||
<%= textilizable issue, :description, :attachments => issue.attachments %>
|
||||
</div>
|
||||
<!-- <#%= l(:field_description)%>: <#%= issue.short_description %> -->
|
||||
</div>
|
||||
</ul>
|
||||
<ul class="list-group-item-meta">
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
</div>
|
||||
|
||||
<div style="padding-bottom: 8px">
|
||||
<div class="font_lighter_sidebar">
|
||||
<div class="font_lighter_sidebar" style="word-break:break-all">
|
||||
<%= textilizable @project.description %>
|
||||
</div>
|
||||
<div class="created_on_project">
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
<% @nav_dispaly_project_label = 1
|
||||
@nav_dispaly_forum_label = 1 %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
# -*coding:utf-8 -*-
|
||||
class RepairFirstPage < ActiveRecord::Migration
|
||||
def change
|
||||
pro_fps = FirstPage.where("page_type = 'project'")
|
||||
if pro_fps.nil? || pro_fps.first.nil?
|
||||
fp = FirstPage.new
|
||||
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||
fp.title = "Trustie在线项目托管平台"
|
||||
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
|
||||
fp.page_type = "project"
|
||||
fp.sort_type = 1
|
||||
fp.save
|
||||
else
|
||||
fp = pro_fps.first
|
||||
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||
fp.title = "Trustie在线项目托管平台"
|
||||
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
|
||||
fp.page_type = "project"
|
||||
fp.sort_type = 1
|
||||
fp.save
|
||||
end
|
||||
course_fps = FirstPage.where("page_type = 'course'")
|
||||
if course_fps.nil? || course_fps.first.nil?
|
||||
fp = FirstPage.new
|
||||
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||
fp.title = "Trustie在线课程实践平台"
|
||||
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
|
||||
fp.page_type = "course"
|
||||
fp.sort_type = 1
|
||||
fp.save
|
||||
else
|
||||
fp = course_fps.first
|
||||
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||
fp.title = "Trustie在线课程实践平台"
|
||||
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
|
||||
fp.page_type = "course"
|
||||
fp.sort_type = 1
|
||||
fp.save
|
||||
end
|
||||
contest_fps = FirstPage.where("page_type = 'contest'")
|
||||
if contest_fps.nil? || contest_fps.first.nil?
|
||||
fp1 = FirstPage.new
|
||||
fp1.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||
fp1.title = "Trustie在线竞赛实战平台"
|
||||
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
|
||||
fp1.page_type = "contest"
|
||||
fp1.sort_type = 1
|
||||
fp1.save
|
||||
else
|
||||
fp1 = contest_fps.first
|
||||
fp1.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||
fp1.title = "Trustie在线竞赛实战平台"
|
||||
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
|
||||
fp1.page_type = "contest"
|
||||
fp1.sort_type = 1
|
||||
fp1.save
|
||||
end
|
||||
end
|
||||
end
|
35
db/schema.rb
35
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20140719030941) do
|
||||
ActiveRecord::Schema.define(:version => 20140719080032) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -809,18 +809,18 @@ ActiveRecord::Schema.define(:version => 20140719030941) do
|
|||
create_table "relative_memos", :force => true do |t|
|
||||
t.integer "osp_id"
|
||||
t.integer "parent_id"
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :limit => 16777215, :null => false
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :null => false
|
||||
t.integer "author_id"
|
||||
t.integer "replies_count", :default => 0
|
||||
t.integer "replies_count", :default => 0
|
||||
t.integer "last_reply_id"
|
||||
t.boolean "lock", :default => false
|
||||
t.boolean "sticky", :default => false
|
||||
t.boolean "is_quote", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "viewed_count_crawl", :default => 0
|
||||
t.integer "viewed_count_local", :default => 0
|
||||
t.boolean "lock", :default => false
|
||||
t.boolean "sticky", :default => false
|
||||
t.boolean "is_quote", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "viewed_count_crawl", :default => 0
|
||||
t.integer "viewed_count_local", :default => 0
|
||||
t.string "url"
|
||||
t.string "username"
|
||||
t.string "userhomeurl"
|
||||
|
@ -844,19 +844,6 @@ ActiveRecord::Schema.define(:version => 20140719030941) do
|
|||
|
||||
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
||||
|
||||
create_table "rich_rich_files", :force => true do |t|
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "rich_file_file_name"
|
||||
t.string "rich_file_content_type"
|
||||
t.integer "rich_file_file_size"
|
||||
t.datetime "rich_file_updated_at"
|
||||
t.string "owner_type"
|
||||
t.integer "owner_id"
|
||||
t.text "uri_cache"
|
||||
t.string "simplified_type", :default => "file"
|
||||
end
|
||||
|
||||
create_table "roles", :force => true do |t|
|
||||
t.string "name", :limit => 30, :default => "", :null => false
|
||||
t.integer "position", :default => 1
|
||||
|
|
Loading…
Reference in New Issue