动态中显示默认分支的统计
This commit is contained in:
parent
a18daeecd1
commit
5e5f677bab
|
@ -321,8 +321,10 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
# g = Gitlab.client
|
||||
unless @project.gpid.nil? || @project.project_score.changeset_num == 0
|
||||
rep_statics_commit = @project.rep_statics
|
||||
rep_statics_code = @project.rep_statics.sort_by {|u| u.changeset}.reverse
|
||||
# rep_statics_commit = @project.rep_statics.order("commits_num desc")
|
||||
rep_statics_commit = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by commits_num desc limit 10")
|
||||
rep_statics_code = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by changeset desc limit 10")
|
||||
# rep_statics_code = @project.rep_statics.sort_by {|u| u.changeset}.reverse
|
||||
@a_uname = rep_statics_commit.map {|s| s.uname }
|
||||
@a_uname_code = rep_statics_code.map {|s| s.uname }
|
||||
@a_commits_num = rep_statics_commit.map {|s| s.commits_num.to_i }
|
||||
|
|
|
@ -348,8 +348,10 @@ update
|
|||
# (show_error_not_found; return) unless @entries
|
||||
g = Gitlab.client
|
||||
@changesets = g.commits(@project.gpid, :ref_name => @rev)
|
||||
g_project = g.project(@project.gpid)
|
||||
# 总的提交数
|
||||
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
|
||||
@changesets_all_count = @project.gpid.nil? ? 0 : g_project.commit_count
|
||||
@g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch
|
||||
# 访问该页面的是会后则刷新
|
||||
if @project.project_score.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
|
@ -579,7 +581,9 @@ update
|
|||
if rep_static.nil?
|
||||
RepStatics.create(:project_id => @project.id, :uname => static.uname, :commits_num => static.commits_num, :email => static.email, :add => static.add, :del => static.del, :changeset => static.changes)
|
||||
else
|
||||
rep_static.update_attributes(:uname => static.uname, :commits_num => static.commits_num, :email => static.email, :add => static.add, :del => static.del, :changeset => static.changes)
|
||||
if @rev == params[:default_branch]
|
||||
rep_static.update_attributes(:uname => static.uname, :commits_num => static.commits_num, :email => static.email, :add => static.add, :del => static.del, :changeset => static.changes)
|
||||
end
|
||||
end
|
||||
end
|
||||
# @static_month__per_user = g.rep_stats(project_id, :rev => rev, :creator => creator, :period => 2)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%= @repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
|
||||
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
|
||||
<div class="fl mt5 ml15">
|
||||
<%=link_to "统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator ), :class => "fl vl_zip" %>
|
||||
<%=link_to "统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %>
|
||||
</div>
|
||||
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
|
||||
<% if User.current.id != @project.user_id %>
|
||||
|
|
Loading…
Reference in New Issue