Apply user project limit only for personal projects. We should not include group projects for user limit

This commit is contained in:
Dmitriy Zaporozhets 2013-06-26 14:41:03 +03:00
parent 0a0cdc6c61
commit db03bfa868
2 changed files with 4 additions and 4 deletions

View file

@ -294,12 +294,12 @@ class User < ActiveRecord::Base
end
def projects_limit_left
projects_limit - owned_projects.count
projects_limit - personal_projects.count
end
def projects_limit_percent
return 100 if projects_limit.zero?
(owned_projects.count.to_f / projects_limit) * 100
(personal_projects.count.to_f / projects_limit) * 100
end
def recent_push project_id = nil

View file

@ -70,9 +70,9 @@
- unless current_user.projects_limit_left > 100
%fieldset
%legend
Owned projects:
Personal projects:
%small.pull-right
%span= current_user.owned_projects.count
%span= current_user.personal_projects.count
of
%span= current_user.projects_limit
.padded