mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-17 18:25:56 +08:00
add: user statistics
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
json.total_contributions @headmaps.collect{|map| map["contributions"]}.reduce(0, :+)
|
||||
json.headmaps @headmaps.each do |map|
|
||||
json.date map["timestamp"]
|
||||
json.date Time.at(map["timestamp"].to_i).strftime("%Y-%m-%d")
|
||||
json.contributions map["contributions"]
|
||||
end
|
||||
|
||||
19
app/views/users/statistics/develop.json.jbuilder
Normal file
19
app/views/users/statistics/develop.json.jbuilder
Normal file
@@ -0,0 +1,19 @@
|
||||
json.platform do
|
||||
json.influence @platform_influence
|
||||
json.contribution @platform_contribution
|
||||
json.activity @platform_activity
|
||||
json.experience @platform_experience
|
||||
json.language @platform_language
|
||||
json.languages_percent @platform_languages_percent
|
||||
json.each_language_score @platform_each_language_score
|
||||
end
|
||||
|
||||
json.user do
|
||||
json.influence @influence
|
||||
json.contribution @contribution
|
||||
json.activity @activity
|
||||
json.experience @experience
|
||||
json.language @language
|
||||
json.languages_percent @languages_percent
|
||||
json.each_language_score @each_language_score
|
||||
end
|
||||
19
app/views/users/statistics/role.json.jbuilder
Normal file
19
app/views/users/statistics/role.json.jbuilder
Normal file
@@ -0,0 +1,19 @@
|
||||
json.total_projects_count @full_member_projects_count
|
||||
json.role do
|
||||
json.owner do
|
||||
json.count @owner_projects_count
|
||||
json.percent (@owner_projects_count.to_f/@full_member_projects_count).round(2)
|
||||
end
|
||||
json.manager do
|
||||
json.count @manager_projects_count
|
||||
json.percent (@manager_projects_count.to_f/@full_member_projects_count).round(2)
|
||||
end
|
||||
json.developer do
|
||||
json.count @developer_projects_count
|
||||
json.percent (@developer_projects_count.to_f/@full_member_projects_count).round(2)
|
||||
end
|
||||
json.reporter do
|
||||
json.count @reporter_projects_count
|
||||
json.percent (@reporter_projects_count.to_f/@full_member_projects_count).round(2)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user