add average size to index page
This commit is contained in:
parent
9df423a720
commit
e1b5259ba6
|
@ -15,6 +15,7 @@
|
|||
<th>Name</th>
|
||||
<th>Count</th>
|
||||
<th>Size</th>
|
||||
<th>Average size</th>
|
||||
</tr>
|
||||
<% order = 0
|
||||
users.sort.each do |user|
|
||||
|
@ -26,6 +27,7 @@
|
|||
<td>#{user.name}</td>
|
||||
<td class=\"right-align\">#{user.count}</td>
|
||||
<td class=\"right-align\">#{Filesize.from(user.size.to_s + "B").pretty}</td>
|
||||
<td class=\"right-align\">#{Filesize.from(user.avgsize.to_s + "B").pretty}</td>
|
||||
</tr>}
|
||||
%>
|
||||
<% end %>
|
||||
|
|
|
@ -8,7 +8,7 @@ erb_file = "dcav-index.erb"
|
|||
html_file = "/var/shots/html/index.html"
|
||||
|
||||
class User
|
||||
attr_accessor :name, :count, :size
|
||||
attr_accessor :name, :count, :size, :avgsize
|
||||
def <=> other
|
||||
other.count <=> count
|
||||
end
|
||||
|
@ -24,6 +24,7 @@ usernames.each do |username|
|
|||
user.count = `ls -1 #{shot_dir}#{username}/ | wc -l | head -n 1`
|
||||
.delete("\n")
|
||||
.to_i
|
||||
user.avgsize = user.size / user.count
|
||||
|
||||
users << user
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user