Commit ceb39b24 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Move _used to helper

parent 32f9b43b
...@@ -74,6 +74,12 @@ module GroupsHelper ...@@ -74,6 +74,12 @@ module GroupsHelper
end end
end end
def group_shared_runner_limits_percent_used(group)
return 0 unless group.shared_runners_minutes_limit_enabled?
100 * group.shared_runners_minutes / group.shared_runners_minutes_limit
end
def group_shared_runner_limits_progress_bar(group) def group_shared_runner_limits_progress_bar(group)
percent = [group.shared_runners_minutes_percent_used, 100].min percent = [group.shared_runners_minutes_percent_used, 100].min
......
...@@ -182,18 +182,13 @@ class Namespace < ActiveRecord::Base ...@@ -182,18 +182,13 @@ class Namespace < ActiveRecord::Base
end end
def shared_runners_minutes_limit_enabled? def shared_runners_minutes_limit_enabled?
shared_runners_minutes_limit.nonzero?
end
def shared_runners_minutes_used?
shared_runners_enabled? && shared_runners_enabled? &&
shared_runners_minutes_limit_enabled? && shared_runners_minutes_limit.nonzero?
shared_runners_minutes.to_i >= shared_runners_minutes_limit
end end
def shared_runners_minutes_percent_used def shared_runners_minutes_used?
return 0 unless shared_runners_enabled? && shared_runners_minutes_limit_enabled? shared_runners_minutes_limit_enabled? &&
100 * shared_runners_minutes.to_i / shared_runners_minutes_limit shared_runners_minutes >= shared_runners_minutes_limit
end end
def full_name def full_name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment