diff --git a/Resource_Info/app.rb b/Resource_Info/app.rb index 02e6e8f..4ea570d 100755 --- a/Resource_Info/app.rb +++ b/Resource_Info/app.rb @@ -56,6 +56,7 @@ def output() limit = (defined_limit[user] == "unlimited")? get_resource_limit(g).to_i : defined_limit[user].to_i / 3600 usage = row[1].to_i / 3600 # NH avail = (defined_limit[user] == "unlimited")? dashboard_resource(g).avail : limit - usage + avail = 0 if avail.to_i < 0 tmp.push([user, limit, usage, avail]) end diff --git a/Resource_Info/views/index.erb b/Resource_Info/views/index.erb index fa2e9e3..ff2c596 100755 --- a/Resource_Info/views/index.erb +++ b/Resource_Info/views/index.erb @@ -35,16 +35,14 @@ input { - - <% if @is_admin[i] %> - - <% end %> + - - - - + + + + + <% @resource_info[i].each do |d| %> @@ -66,25 +64,26 @@ input { <%= ratio(usage, limit) %>% - <% if @is_admin[i] %> - <% end %> <% else %> - <% if @is_admin[i] %> <% end %> - <% end %> <% end %>
UserResource (NH)Change LimitResource (NH)
LimitUsageAvailableRatioLimitUsageAvailableRatioChange Limit
(For only a theme manager)
- - - - + <% if @is_admin[i] %> + + + + + <% else %> + + + <% end %>
- - - - -
diff --git a/misc/utils.rb b/misc/utils.rb index 65d698c..9df9cb5 100644 --- a/misc/utils.rb +++ b/misc/utils.rb @@ -1083,8 +1083,8 @@ def dashboard_date() end def ratio(a, b, limit = NOT_USED) - if b.to_i == 0 - return 0 + if a.to_i > b.to_i + return 100 else if limit != NOT_USED v = (a.to_f * 100/ b.to_f)