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