From 09eae9e2530ba66ad09d1cee16eb2fa4ad7b1143 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 19 Jun 2014 20:14:48 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=BE=97=E5=88=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=202.=E5=B0=81=E8=A3=85=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BE=97=E5=88=86=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=BF=9D=E7=95=992=E4=BD=8D=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 25 +++++++++++++++++++ app/views/bids/_homework.html.erb | 2 +- app/views/bids/_homework_list.html.erb | 33 ++++++++++++++------------ 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 90bbe101b..3d52e5fb0 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -210,4 +210,29 @@ module CoursesHelper teacher_stars = homework.rates(:quality).where("rater_id = #{member.user_id}").select("stars").first return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars) end + + def project_score project + issue_count = project.issues.count + issue_journal_count = project.issue_changes.count + issue_score = issue_count * 0.2 + issue_journal_score = issue_journal_count * 0.1 + finall_issue_score = issue_score + issue_journal_score + new_count = project.news.count + new_score = new_count * 0.1 + finall_new_score = new_score + document_count = project.documents.count + file_score = document_count * 0.1 + finall_file_score = file_score + changeset_count = project.changesets.count + code_submit_score = changeset_count * 0.3 + finall_code_submit_score = code_submit_score + board_message_count = 0 + project.boards.each do |board| + board_message_count += board.messages_count + end + topic_score = board_message_count * 0.1 + #finall_topic_score = topic_score + finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score + format("%.2f",finall_project_score) + end end diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 1a55dc243..11b478199 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -28,7 +28,7 @@ @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>