commit
46ba7f6a7b
@ -0,0 +1,3 @@
|
||||
class CourseAttachment < ActiveRecord::Base
|
||||
attr_accessible :attachtype, :author_id, :content_type, :description, :digest, :disk_directory, :disk_filename, :downloads, :filename, :filesize, :integer, :is_public
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
class ProjectScore < ActiveRecord::Base
|
||||
attr_accessible :project_id, :score
|
||||
belongs_to :project, foreign_key: :project_id
|
||||
end
|
@ -1,8 +1,9 @@
|
||||
<div>技术得分:</div>
|
||||
<div> 踩别人的帖子 -2</div>
|
||||
<div> 帖子被一级会员顶 +4</div>
|
||||
<div> 帖子被二级会员顶 +6</div>
|
||||
<div> 帖子被三级会员顶 +8</div>
|
||||
<div> 帖子被一级会员踩 -2</div>
|
||||
<div> 帖子被二级会员踩 -4</div>
|
||||
<div> 帖子被三级会员踩 -6</div>
|
||||
|
||||
<div> 踩别人的帖子数量 * (-2) = <%= option_num.tread %> * (-2) = <%= option_num.tread * (-2) %></div>
|
||||
<div> 帖子被一级会员顶的次数 * 4 = <%= option_num.praise_by_one %> * 4 = <%= option_num.praise_by_one * 4 %></div>
|
||||
<div> 帖子被二级会员顶的次数 * 6 = <%= option_num.praise_by_two %> * 6 = <%= option_num.praise_by_two * 6 %></div>
|
||||
<div> 帖子被三级会员顶的次数 * 8 = <%= option_num.praise_by_three %> * 8 = <%= option_num.praise_by_three * 8 %></div>
|
||||
<div> 帖子被一级会员踩的次数 * (-2) = <%= option_num.tread_by_one %> * (-2) = <%= option_num.tread_by_one * (-2) %></div>
|
||||
<div> 帖子被二级会员踩的次数 * (-4) = <%= option_num.tread_by_two %> * (-4) = <%= option_num.tread_by_two * (-4) %></div>
|
||||
<div> 帖子被三级会员踩的次数 * (-6) = <%= option_num.tread_by_three %> * (-6) = <%= option_num.tread_by_three * (-6) %></div>
|
||||
<div> 技术得分 = <%= option_num.tread * (-2) %> + <%= option_num.praise_by_one * 4 %> + <%= option_num.praise_by_two * 6 %> + <%= option_num.praise_by_three * 8 %> + (<%= option_num.tread_by_one * (-2) %>) + ( <%= option_num.tread_by_two * (-4) %>) + (<%= option_num.tread_by_three * (-6) %>) = <%= skill(option_num) %> </div>
|
@ -1,6 +1,7 @@
|
||||
<div>项目贡献得分:</div>
|
||||
<div> 提交代码 +4</div>
|
||||
<div> 提交文档 +4</div>
|
||||
<div> 提交附件 +4</div>
|
||||
<div> 更新缺陷完成度 +2</div>
|
||||
<div> 发布缺陷 +4</div>
|
||||
|
||||
<div> 提交代码次数 * 4 = <%= option_num.changeset %> * 4 = <%= option_num.changeset * 4 %></div>
|
||||
<div> 提交文档次数 * 4 = <%= option_num.document %> * 4 = <%= option_num.document * 4 %></div>
|
||||
<div> 提交附件次数 * 4 = <%= option_num.attachment %> * 4 = <%= option_num.attachment * 4 %></div>
|
||||
<div> 更新缺陷完成度次数 * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
|
||||
<div> 发布缺陷数量 * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
|
||||
<div> 项目贡献得分 = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> = <%= active(option_num) %> </div>
|
@ -1,2 +1,3 @@
|
||||
<div>影响力得分:</div>
|
||||
<div> 被关注人数 +2/人</div>
|
||||
|
||||
<div> 被关注人数 * 2 = <%= option_num.follow %> * 2 = <%= option_num.follow * 2 %></div>
|
||||
<div> 影响力得分 = <%= option_num.follow * 2 %></div>
|
||||
|
@ -1,34 +1,10 @@
|
||||
<!-- added by bai -->
|
||||
<%# messages_count = @user.messages.count %>
|
||||
<%# messages_score = messages_count * 0.05%>
|
||||
<%# finall_messages_score = messages_score %>
|
||||
|
||||
<%# journals_count = @user.journals.count %>
|
||||
<%# journals_score = journals_count * 0.1 %>
|
||||
<%# user_changesets_count = @user.changesets.count %>
|
||||
<%# user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<%# finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<%# journals_for_messages_count = @user.journals_messages.count %>
|
||||
<%# activities_count = @user.activities.count %>
|
||||
<%# journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<%# activities_score = activities_count * 0.2 %>
|
||||
<%# finall_activity_score = journals_for_messages_score + activities_score %>
|
||||
|
||||
<%# news_count = @user.news.count %>
|
||||
<%# news_score = news_count * 0.1 %>
|
||||
<%# wiki_contents_count = @user.wiki_contents.count %>
|
||||
<%# wiki_contents_score = wiki_contents_count * 0.1 %>
|
||||
<%# comments_count = @user.comments.count %>
|
||||
<%# comments_score = comments_count * 0.1 %>
|
||||
<%# finall_influence_score = news_score + wiki_contents_score + comments_score %>
|
||||
<%# finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
|
||||
|
||||
<div><%= l(:label_user_score) %></div>
|
||||
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
|
||||
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
|
||||
<!-- <div> + <%#= l(:label_user_score_of_influence) %></div> -->
|
||||
<div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_i %>
|
||||
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %></div>
|
||||
<div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_i %></div>
|
||||
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
|
||||
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div>
|
||||
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
|
||||
<!-- end -->
|
||||
|
@ -1,6 +1,7 @@
|
||||
<%= l(:label_user_grade)%>:
|
||||
<!-- user.user_score_attr.total_score -->
|
||||
<%= link_to(format("%.2f" ,user_scores(user,1).total_score ).to_i, {:controller => 'users',
|
||||
<!-- user_scores(user,1).total_score -->
|
||||
<%= link_to(format("%.2f" ,get_option_number(user,1).total_score ).to_i, {:controller => 'users',
|
||||
:action => 'show_new_score',
|
||||
:remote => true,
|
||||
:id => user.id
|
||||
|
@ -1,4 +1,5 @@
|
||||
<div class="wiki wiki-page">
|
||||
<%= textilizable content, :text, :attachments => content.page.attachments,
|
||||
<%= textAreailizable content, :text, :attachments => content.page.attachments,
|
||||
:edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %>
|
||||
<%#= content.text.html_safe %>
|
||||
</div>
|
||||
|
@ -0,0 +1,10 @@
|
||||
class CreateProjectScores < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :project_scores do |t|
|
||||
t.string :project_id
|
||||
t.integer :score
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,20 @@
|
||||
class CreateCourseAttachments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :course_attachments do |t|
|
||||
t.string :filename
|
||||
t.string :disk_filename
|
||||
t.integer :filesize
|
||||
t.string :content_type
|
||||
t.string :digest
|
||||
t.integer :downloads
|
||||
t.string :author_id
|
||||
t.string :integer
|
||||
t.string :description
|
||||
t.string :disk_directory
|
||||
t.integer :attachtype
|
||||
t.integer :is_public
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddColunToCourseAttachments < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :course_attachments, :container_id, :integer, :default => 0
|
||||
end
|
||||
end
|
@ -0,0 +1,29 @@
|
||||
class UpdateCourseAttachments < ActiveRecord::Migration
|
||||
def up
|
||||
attachments = Attachment.where(" container_type = 'Course'")
|
||||
attachments.each do |attachment|
|
||||
course_attachment = CourseAttachment.new
|
||||
course_attachment.container_id = attachment.container_id
|
||||
course_attachment.filename = attachment.filename
|
||||
course_attachment.disk_filename = attachment.disk_filename
|
||||
course_attachment.filesize = attachment.filesize
|
||||
course_attachment.content_type = attachment.content_type
|
||||
course_attachment.digest = attachment.digest
|
||||
course_attachment.downloads = attachment.downloads
|
||||
course_attachment.author_id = attachment.author_id
|
||||
course_attachment.created_at = attachment.created_on
|
||||
course_attachment.description = attachment.description
|
||||
course_attachment.disk_directory = attachment.disk_directory
|
||||
course_attachment.attachtype = attachment.attachtype
|
||||
course_attachment.is_public = attachment.is_public
|
||||
course_attachment.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
coll = CourseAttachment.all
|
||||
coll.each do |model|
|
||||
model.destroy
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class ChangeForumDescription < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :forums, :description, :text, default: nil
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :forums, :description, :string, default: ''
|
||||
end
|
||||
end
|
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>File not found</title>
|
||||
<style>
|
||||
body{
|
||||
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
|
||||
color:#303030;
|
||||
}
|
||||
div.container{
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
}
|
||||
h1{
|
||||
font-size:1.5em;
|
||||
}
|
||||
p{
|
||||
font-size:0.8em;
|
||||
}
|
||||
.hidden{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" >
|
||||
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
|
||||
<h1><%= l(:lable_file_not_found) %></h1>
|
||||
<h3> <a href="http://forge.trustie.net" style=""><%= l(:lable_goto_homepage) %></a> </h3>
|
||||
|
||||
<div class="container" style="">
|
||||
<div style="position: relative; right:0;text-align: right;">
|
||||
<h4><%= l(:lable_trustie_team) %></h4>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hidden" >
|
||||
<a href="javascript:history.back()">Back</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
project_id: MyString
|
||||
score: 1
|
||||
|
||||
two:
|
||||
project_id: MyString
|
||||
score: 1
|
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProjectScoreTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in new issue