From 49aa3a994ea0ff764d230c48edc29816e3eb6cf5 Mon Sep 17 00:00:00 2001 From: nwb Date: Sat, 19 Jul 2014 15:58:11 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AD=A6=E6=97=B6=E4=B8=8D=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/models/course.rb | 2 +- db/schema.rb | 33 ++++++++++----------------------- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 033b6405c..59acc188b 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -371,7 +371,7 @@ module CoursesHelper #获取作业的教师评分 def teacher_score_for_homework homework - member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first + member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first if member.nil? return "0.00" end diff --git a/app/models/course.rb b/app/models/course.rb index 04b0535bd..1c2828adc 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -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]+$/ diff --git a/db/schema.rb b/db/schema.rb index 87e6be3f3..a94793913 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 From ba66cde8406a47a1a3449ef962ca1bdc0725e8c8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 19 Jul 2014 16:38:29 +0800 Subject: [PATCH 2/6] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=95=8C=E9=9D=A2=E5=8A=A0=E8=BD=BD=E6=95=88?= =?UTF-8?q?=E7=8E=87=202.=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=9A=84=E4=BA=92=E8=AF=84=E5=BE=97=E5=88=86=E3=80=81?= =?UTF-8?q?=E7=BB=BC=E8=AF=84=E5=BE=97=E5=88=86=E3=80=81=E6=95=99=E5=B8=88?= =?UTF-8?q?=E8=AF=84=E5=88=86=E4=B8=8D=E5=87=86=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 36 +++++++++++++++++++------- app/views/bids/_homework_list.html.erb | 9 ++++--- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 033b6405c..e971970bc 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -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 #获取指定项目的得分 diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index a8f1f4356..8b241030a 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -117,9 +117,9 @@ 互评得分:  - <% student_homework_score = student_score_for_homework(homework) %> - ;"> - <% score = student_homework_score == "0.00"? "N/A" : student_homework_score %> + <%# student_homework_score = student_score_for_homework(homework) %> + ;"> + <% score = homework.s_score.nil? ? "N/A" : format("%.2f",homework.s_score) %> <%= score %>    <% if is_evaluation && is_student && (!users_for_homework(homework).include? User.current)%> @@ -136,7 +136,8 @@ 终评得分:  - <% 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)) %> ;"> <% score = totle_homework_score == "0.00"? "N/A" : totle_homework_score %> <%= score %> From 5c0e3e96cc61b458e4b95342359d547c4b11408d Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 19 Jul 2014 16:41:29 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AF=BC=E8=88=AA=E6=A0=8F=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=81=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=E3=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E5=A4=8DFirstPage=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/show_attendingcontest.html.erb | 2 +- app/views/courses/index.html.erb | 4 ++ app/views/issues/_list.html.erb | 5 +- app/views/projects/index.html.erb | 2 + .../20140719080032_repair_first_page.rb | 59 +++++++++++++++++++ db/schema.rb | 37 ++++-------- 6 files changed, 82 insertions(+), 27 deletions(-) create mode 100644 db/migrate/20140719080032_repair_first_page.rb diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 6430a7c9a..cb6024e29 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -131,7 +131,7 @@ <%= l(:label_work_deposit_project) %>: <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2' %> - <%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0} , :target => '_blank',host:Setting.project_domain %> + <%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %>

diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 0586262e9..24eefd4cb 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -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 %> diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 57d8a60cb..c9fecc6a9 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -38,7 +38,10 @@ <% end -%>
    - <%= l(:field_description)%>: <%= issue.short_description %> +
    + <%= textilizable issue, :description, :attachments => issue.attachments %> +
    +
    diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index c4b2bdc9e..5d479bced 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -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 %> diff --git a/db/migrate/20140719080032_repair_first_page.rb b/db/migrate/20140719080032_repair_first_page.rb new file mode 100644 index 000000000..a1faf7f90 --- /dev/null +++ b/db/migrate/20140719080032_repair_first_page.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 4a14a02f2..d7c625bd2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140716021558) 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 => 20140716021558) 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 => 20140716021558) 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 @@ -916,7 +903,7 @@ ActiveRecord::Schema.define(:version => 20140716021558) do create_table "softapplications", :force => true do |t| t.string "name" - t.string "description" + t.text "description" t.integer "app_type_id" t.string "app_type_name" t.string "android_min_version_available" From e24323147d00ba1331690ec7ee9961217fcc6a9a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 19 Jul 2014 16:45:27 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E8=BF=87=E9=95=BF=E4=B8=8D=E4=BC=9A=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=8D=A2=E8=A1=8C=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_projects.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index ef26df0bd..fa20bdff6 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -149,7 +149,7 @@
    -
    +
    <%= textilizable @project.description %>
    From 0322258386898a6456bfd4b282e12550ee2f41e8 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 19 Jul 2014 16:52:43 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=8F=82=E5=8A=A0=E7=AB=9E=E8=B5=9B=E4=B8=AD=E5=A4=9A=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E7=9A=84=E9=A1=B9=E7=9B=AE=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/show_attendingcontest.html.erb | 1 - db/schema.rb | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 26aa3ccd4..324571771 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -147,7 +147,6 @@ <%= l(:label_work_deposit_project) %>: <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %> <%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %> - <%= link_to l(:label_create_new_projects), new_project_path(course: 0, project_type: 0), :target => '_blank' %>

    diff --git a/db/schema.rb b/db/schema.rb index d7c625bd2..690ec2681 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1199,4 +1199,10 @@ ActiveRecord::Schema.define(:version => 20140719080032) do add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + end From f273b60f32e9474303362df649a255dfa0f92cbc Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 19 Jul 2014 17:04:44 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0ReadMe.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReadMe.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 129b99216..32ac107e3 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,4 +1,4 @@ -patch: +patch: 用户姓名的部分,根据issues#655。 为了修改方便 alias: @@ -65,4 +65,8 @@ bundle exec rake db:migrate:up VERSION=20140410021724 2 启动rails 3 运行migrate 3 打开admin配置插件(http://127.0.0.1:3000/settings/plugin/redmine_ckeditor) -4 点击“查询”(就是确定的功能) \ No newline at end of file +4 点击“查询”(就是确定的功能) +=============================================================================== +0719:若遇到首页定制报错问题请尝试如下操作 +1.运行 bundle exec rake db:migrate:down version=20140719080032 +2.运行 bundle exec rake db:migrate:up version=20140719080032 \ No newline at end of file