项目得分新计算
This commit is contained in:
parent
20a657508d
commit
f3402e4fa4
|
@ -1,9 +1,9 @@
|
||||||
<div style="color: #64BDD9;font-size: 14px;font-weight: bold"><%= l(:label_projects_score) %></div>
|
<div style="color: #64BDD9;font-size: 14px;font-weight: bold"><%= l(:label_projects_score) %></div>
|
||||||
<div> = <%= l(:label_code_submit_score) %> + <%= l(:label_issue_score) %> + <%= l(:label_file_attachment_score) %> + <%= l(:label_topic_score) %> + <%= l(:label_news_score) %></div>
|
<div> = <%= l(:label_code_submit_score) %> + <%= l(:label_issue_score) %> + <%= l(:label_file_attachment_score) %> + <%= l(:label_topic_score) %> + <%= l(:label_news_score) %></div>
|
||||||
<div> = <%= @project.commits_count * 4 %> +
|
<div> = <%= @project.project_score.changeset_num * 4 %> +
|
||||||
<%= @project.issues_count * 4 + @project.journals_count %> +
|
<%= @project.project_score.issue_num * 4 + @project.project_score.issue_journal_num %> +
|
||||||
<%= @project.attachments_count * 5 %> +
|
<%= @project.project_score.attach_num * 5 %> +
|
||||||
<%= @project.boards_count * 2 + @project.boards_reply_count %> +
|
<%= @project.project_score.board_num * 2 + @project.project_score.board_message_num %> +
|
||||||
<%= @project.news_count %>
|
<%= @project.project_score.news_num %>
|
||||||
</div>
|
</div>
|
||||||
<div> = <%= static_project_score(@project) %></div>
|
<div> = <%= static_project_score(@project.project_score) %></div>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<td width="35%">
|
<td width="35%">
|
||||||
<table>
|
<table>
|
||||||
<tr class="info_font" style="color: #64BDD9;font-size: 14px;font-weight: bold"><td><%= l(:label_projects_score) %></td></tr>
|
<tr class="info_font" style="color: #64BDD9;font-size: 14px;font-weight: bold"><td><%= l(:label_projects_score) %></td></tr>
|
||||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= static_project_score(@project) %></span></td></tr>
|
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= static_project_score(@project.project_score) %></span></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -22,22 +22,22 @@
|
||||||
<div class="tabs_new">
|
<div class="tabs_new">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_projects_score),"javascript:void(0)", :onclick => "show_div('project_score_index')"%> : <%= static_project_score(@project) %>
|
<%= link_to l(:label_projects_score),"javascript:void(0)", :onclick => "show_div('project_score_index')"%> : <%= static_project_score(@project.project_score) %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_code_submit_score), "javascript:void(0)", :onclick => "show_div('code_submit_score_index')" %> : <%= @project.commits_count * 4 %>
|
<%= link_to l(:label_code_submit_score), "javascript:void(0)", :onclick => "show_div('code_submit_score_index')" %> : <%= @project.project_score.changeset_num * 4 %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.issues_count * 4 + @project.journals_count %>
|
<%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.issue_num * 4 + @project.project_score.issue_journal_num %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.attachments_count * 5 %>
|
<%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.attach_num * 5 %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> : <%= @project.boards_count * 2 + @project.boards_reply_count %>
|
<%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> : <%= @project.project_score.board_num * 2 + @project.project_score.board_message_num %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_news_score), "javascript:void(0)", :onclick => "show_div('news_score_index')"%> : <%= @project.news_count %>
|
<%= link_to l(:label_news_score), "javascript:void(0)", :onclick => "show_div('news_score_index')"%> : <%= @project.project_score.news_num %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class AddBoardNumToProjectScore < ActiveRecord::Migration
|
class AddBoardNumToProjectScore < ActiveRecord::Migration
|
||||||
def change
|
def change
|
||||||
add_column :project_scores, :board_num, :integer, :default => false
|
add_column :project_scores, :board_num, :integer, :default => false
|
||||||
add_column :project_scores, :act_num, :integer, :default => false
|
|
||||||
add_column :project_scores, :attach_num, :integer, :default => false
|
add_column :project_scores, :attach_num, :integer, :default => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,11 +34,6 @@ class UpdateProjectScore < ActiveRecord::Migration
|
||||||
news_count = project.news.count
|
news_count = project.news.count
|
||||||
project.project_score.update_attribute(:news_num, news_count)
|
project.project_score.update_attribute(:news_num, news_count)
|
||||||
end
|
end
|
||||||
# update acts
|
|
||||||
acts = ForgeActivity.where("project_id = ?", project.id)
|
|
||||||
unless acts.blank?
|
|
||||||
project.project_score.update_attribute(:act_num, acts.count)
|
|
||||||
end
|
|
||||||
# update attach
|
# update attach
|
||||||
unless project.attachments.nil?
|
unless project.attachments.nil?
|
||||||
attachments_count = project.attachments.count
|
attachments_count = project.attachments.count
|
||||||
|
|
|
@ -1365,7 +1365,6 @@ ActiveRecord::Schema.define(:version => 20160114022928) do
|
||||||
t.integer "changeset_num", :default => 0
|
t.integer "changeset_num", :default => 0
|
||||||
t.integer "board_message_num", :default => 0
|
t.integer "board_message_num", :default => 0
|
||||||
t.integer "board_num", :default => 0
|
t.integer "board_num", :default => 0
|
||||||
t.integer "act_num", :default => 0
|
|
||||||
t.integer "attach_num", :default => 0
|
t.integer "attach_num", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue