rail_stat_generator 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,130 +1,256 @@
1
- class RailStat < ActiveRecord::Base
2
-
3
- # Method returns paths hash with to 40 paths whith value = top index (1..40)
4
- def RailStat.get_ordered40resources(subdomain)
5
- ordered_resources = []
6
- find_by_sql("SELECT resource, COUNT(resource) AS requests, max(dt) as dt " +
7
- "FROM rail_stats WHERE subdomain = '#{subdomain}' " +
8
- "GROUP BY resource ORDER BY dt DESC LIMIT 40").each { |row|
9
- ordered_resources << row
10
- }
11
- i = 1
12
- orh = {}
13
- ordered_resources = ordered_resources.sort {|x,y| y['requests'].to_i <=> x['requests'].to_i }
14
- ordered_resources.each { |row|
15
- orh[row['resource']] = i
16
- i = i + 1
17
- } unless ordered_resources.nil? or ordered_resources.size == 0
18
- return orh, ordered_resources
19
- end
20
-
21
- def RailStat.find_all_by_flag(include_search_engine, number_hits, subdomain)
22
- if include_search_engine
23
- find_all(["subdomain = ? and browser <> 'Crawler/Search Engine'", subdomain], ["dt desc"], [number_hits,0])
24
- else
25
- find_all(["subdomain = ?", subdomain], ["dt desc"], [number_hits,0])
26
- end
27
- end
28
-
29
- def marked?
30
- (@marked and @marked == true)
31
- end
32
-
33
- def mark
34
- @marked = true
35
- end
36
-
37
- def RailStat.get_last_week_stats(subdomain)
38
- find_by_sql("select date_format(from_unixtime(dt), '%Y-%m-%d' ) as hdate, count(*) as hits " +
39
- "from rail_stats " +
40
- "where to_days(now()) - to_days(from_unixtime(dt)) <= 7 and subdomain = '#{subdomain}' " +
41
- "group by hdate order by 1 desc;")
42
- end
43
-
44
- def RailStat.find_first_hit(subdomain)
45
- find(:first, :conditions => ["subdomain = ?", subdomain], :order => "dt ASC")
46
- end
47
-
48
- def datetime
49
- Time.at(self.dt)
50
- end
51
-
52
- def RailStat.total_count(subdomain)
53
- RailStat.count(["subdomain = ?", subdomain])
54
- end
55
-
56
- def RailStat.unique_count(subdomain)
57
- uniques = 0
58
- connection.select_all("SELECT COUNT(DISTINCT remote_ip) AS 'hits' from rail_stats " <<
59
- "where subdomain = '#{subdomain}';").each { |row|
60
- uniques = row['hits'].to_i
61
- }
62
- uniques
63
- end
64
-
65
- def RailStat.total_day_count(subdomain, date)
66
- totals = 0
67
- connection.select_all("SELECT COUNT(*) AS 'hits' from rail_stats " <<
68
- "where subdomain = '#{subdomain}' and to_days('#{date}') - to_days(from_unixtime(dt)) = 0").each { |row|
69
- totals = row['hits'].to_i
70
- }
71
- totals
72
- end
73
-
74
- def RailStat.unique_day_count(subdomain, date)
75
- uniques = 0
76
- connection.select_all("SELECT COUNT(DISTINCT remote_ip) AS 'hits' from rail_stats " <<
77
- "where subdomain = '#{subdomain}' and to_days('#{date}') - to_days(from_unixtime(dt)) = 0").each { |row|
78
- uniques = row['hits'].to_i
79
- }
80
- uniques
81
- end
82
-
83
- def RailStat.platform_stats(subdomain, hits)
84
- find_by_sql("SELECT platform, COUNT(platform) AS 'total', (COUNT(platform)/#{hits})*100 as percent " +
85
- "FROM rail_stats " +
86
- "WHERE subdomain = '#{subdomain}' " +
87
- "GROUP BY platform " +
88
- "ORDER BY total DESC; ")
89
- end
90
-
91
- def RailStat.browser_stats(subdomain, hits)
92
- find_by_sql("SELECT browser, version, COUNT(*) AS 'total', (COUNT(*)/#{hits})*100 as percent " +
93
- "FROM rail_stats " +
94
- "WHERE browser != 'unknown' and subdomain = '#{subdomain}'" +
95
- "GROUP BY browser, version " +
96
- "ORDER BY total DESC; ")
97
- end
98
-
99
- def RailStat.language_stats(subdomain, hits)
100
- find_by_sql("SELECT language, COUNT(*) AS 'total', (COUNT(*)/#{hits})*100 as percent " +
101
- "FROM rail_stats " +
102
- "WHERE language != '' and language is not null and language != 'empty' and subdomain = '#{subdomain}'" +
103
- "GROUP BY language " +
104
- "ORDER BY total DESC; ")
105
- end
106
-
107
- def RailStat.country_stats(subdomain, hits)
108
- find_by_sql("SELECT country, COUNT(*) AS 'total', (COUNT(*)/#{hits})*100 as percent " +
109
- "FROM rail_stats " +
110
- "WHERE country != '' and country is not null and subdomain = '#{subdomain}'" +
111
- "GROUP BY country " +
112
- "ORDER BY total DESC; ")
113
- end
114
-
115
- def RailStat.domain_stats(subdomain)
116
- find_by_sql("SELECT domain, referer, resource, COUNT(domain) AS 'total' " +
117
- "FROM rail_stats " +
118
- "WHERE domain != '' and subdomain = '#{subdomain}'" +
119
- "GROUP BY domain " +
120
- "ORDER BY total DESC, dt DESC; ")
121
- end
122
-
123
- def RailStat.stats_dyn(column, subdomain, hits)
124
- find_by_sql("SELECT #{column}, COUNT(*) AS 'total', (COUNT(*)/#{hits})*100 as percent " +
125
- "FROM rail_stats " +
126
- "WHERE subdomain = '#{subdomain}'" +
127
- "GROUP BY #{column} " +
128
- "ORDER BY total DESC; ")
129
- end
130
- end
1
+ class RailStat < ActiveRecord::Base
2
+
3
+ # Method returns paths hash with to 40 paths whith value = top index (1..40)
4
+
5
+ def RailStat.resource_count_totals()
6
+ find_by_sql("SELECT resource, COUNT(resource) AS requests, max(created_at) AS last_access FROM rail_stats GROUP BY resource ORDER BY requests DESC")
7
+ end
8
+
9
+ def RailStat.find_all_by_flag(include_search_engine, number_hits, subdomain)
10
+ if subdomain.nil?
11
+ if include_search_engine
12
+ find(:all, :conditions => "browser <> 'Crawler/Search Engine'", :order => "created_at desc", :limit => number_hits)
13
+ else
14
+ find(:all, :order => "created_at desc", :limit => number_hits)
15
+ end
16
+ else
17
+ if include_search_engine
18
+ find(:all, :conditions => ["subdomain = ? and browser <> 'Crawler/Search Engine'", subdomain], :order => "created_at desc", :limit => number_hits)
19
+ else
20
+ find(:all, :conditions => ["subdomain = ?", subdomain], :order => "created_at desc", :limit => number_hits)
21
+ end
22
+ end
23
+ end
24
+
25
+ ####
26
+ #
27
+ # Misc Methods (What are these?)
28
+ #
29
+ ####
30
+
31
+ def marked?
32
+ (@marked and @marked == true)
33
+ end
34
+
35
+ def mark
36
+ @marked = true
37
+ end
38
+
39
+ def RailStat.get_ordered40resources(subdomain)
40
+ ordered_resources = []
41
+ if subdomain.nil?
42
+ find_by_sql("SELECT resource, COUNT(resource) AS requests, max(created_at) AS created_at " +
43
+ "FROM rail_stats " +
44
+ "GROUP BY resource ORDER BY created_at DESC LIMIT 40").each { |row|
45
+ ordered_resources << row
46
+ }
47
+ else
48
+ find_by_sql("SELECT resource, COUNT(resource) AS requests, max(created_at) AS created_at " +
49
+ "FROM rail_stats WHERE subdomain = '#{subdomain}' " +
50
+ "GROUP BY resource ORDER BY created_at DESC LIMIT 40").each { |row|
51
+ ordered_resources << row
52
+ }
53
+ end
54
+ i = 1
55
+ orh = {}
56
+ ordered_resources = ordered_resources.sort {|x,y| y['requests'].to_i <=> x['requests'].to_i }
57
+ ordered_resources.each { |row|
58
+ orh[row['resource']] = i
59
+ i = i + 1
60
+ } unless ordered_resources.nil? or ordered_resources.size == 0
61
+ return orh, ordered_resources
62
+ end
63
+
64
+ def datetime
65
+ Time.at(self.created_at)
66
+ end
67
+
68
+ ####
69
+ #
70
+ # Counters
71
+ #
72
+ ####
73
+
74
+ ###
75
+ # count_hits
76
+ #
77
+ # parameters:
78
+ # :unique => get stats for distinct remote IPs
79
+ # :subdomain => restrict results to a single subdomain
80
+ # :date => restrict results to a single date
81
+ #
82
+ # examples:
83
+ # RailStat.count_hits : returns stats for all hits
84
+ # RailStat.count_hits(:unique) : returns stats for only unique IPs
85
+ # RailStat.count_hits(:date => d) : returns stats for the date 'd'
86
+ # RailStat.count_hits(:unique, :subdomain => "mydomain", :date => d) : returns stats for unique IPs accessing the specified subdomain on the date 'd'
87
+ ###
88
+
89
+ def RailStat.count_hits(*params)
90
+
91
+ query = "select"
92
+ where = ""
93
+
94
+ if params.include?(:unique)
95
+ query << " count(distinct remote_ip)"
96
+ else
97
+ query << " count(*)"
98
+ end
99
+
100
+ query << " as hits from rail_stats"
101
+
102
+ if params.size == 1
103
+ if params[0].class == Hash
104
+ options = params[0]
105
+ end
106
+ elsif params.size == 2
107
+ options = params[1]
108
+ end
109
+
110
+ if options
111
+ if options[:subdomain]
112
+ where << " subdomain = '#{options[:subdomain]}'"
113
+ end
114
+
115
+ if options[:subdomain] and (options[:date] or options[:past_days])
116
+ where << " AND"
117
+ end
118
+
119
+ if options[:date]
120
+ where << " created_on = '#{options[:date]}'"
121
+ elsif options[:past_days]
122
+ where << " created_on >= '#{(Time.now - options[:past_days]*24*60*60).strftime("%Y-%m-%d")}'"
123
+ end
124
+ end
125
+
126
+ query << " where " << where if where != ""
127
+ query << ";"
128
+
129
+ find_by_sql(query)[0]['hits'].to_i
130
+
131
+ end
132
+
133
+
134
+ ####
135
+ #
136
+ # Finders
137
+ #
138
+ ####
139
+
140
+ ##
141
+ # find_by_days: Find the hits in the specified previous X days. Default is 7 days.
142
+ ##
143
+ def RailStat.find_by_days(params = {})
144
+ params[:days] = 7 unless params[:days]
145
+ query = "SELECT created_on, COUNT(*) AS total_hits, COUNT(DISTINCT remote_ip) AS unique_hits FROM rail_stats WHERE created_on >= '#{(Time.now - params[:days]*24*60*60).strftime("%Y-%m-%d")}'"
146
+ query << " AND subdomain = '#{params[:subdomain]}'" if params[:subdomain]
147
+ query << " GROUP BY created_on;"
148
+ find_by_sql(query)
149
+ end
150
+
151
+ ##
152
+ # find_first_hit: What is this used for?
153
+ ##
154
+ def RailStat.find_first_hit(params = {})
155
+ if params[:subdomain].nil?
156
+ find(:first, :order => "created_at ASC")
157
+ else
158
+ find(:first, :conditions => ["subdomain = ?", params[:subdomain]], :order => "created_at ASC")
159
+ end
160
+ end
161
+
162
+ def RailStat.find_by_platform(params = {})
163
+ if params[:subdomain].nil?
164
+ find_by_sql("SELECT platform, COUNT(platform) AS total " +
165
+ "FROM rail_stats " +
166
+ "GROUP BY platform " +
167
+ "ORDER BY total DESC; ")
168
+ else
169
+ find_by_sql("SELECT platform, COUNT(platform) AS total " +
170
+ "FROM rail_stats " +
171
+ "WHERE subdomain = '#{params[:subdomain]}' " +
172
+ "GROUP BY platform " +
173
+ "ORDER BY total DESC; ")
174
+ end
175
+ end
176
+
177
+ def RailStat.find_by_browser(params = {})
178
+ if params[:subdomain].nil?
179
+ find_by_sql("SELECT browser, version, COUNT(*) AS total " +
180
+ "FROM rail_stats " +
181
+ "GROUP BY browser, version " +
182
+ "ORDER BY total DESC; ")
183
+ else
184
+ find_by_sql("SELECT browser, version, COUNT(*) AS total " +
185
+ "FROM rail_stats " +
186
+ "WHERE subdomain = '#{params[:subdomain]}'" +
187
+ "GROUP BY browser, version " +
188
+ "ORDER BY total DESC; ")
189
+ end
190
+ end
191
+
192
+ def RailStat.find_by_language(params = {})
193
+ if params[:subdomain].nil?
194
+ find_by_sql("SELECT language, COUNT(*) AS total " +
195
+ "FROM rail_stats " +
196
+ "WHERE language != '' and language is not null and language != 'empty' " +
197
+ "GROUP BY language " +
198
+ "ORDER BY total DESC; ")
199
+ else
200
+ find_by_sql("SELECT language, COUNT(*) AS total " +
201
+ "FROM rail_stats " +
202
+ "WHERE language != '' and language is not null and language != 'empty' and subdomain = '#{params[:subdomain]}'" +
203
+ "GROUP BY language " +
204
+ "ORDER BY total DESC; ")
205
+ end
206
+ end
207
+
208
+ def RailStat.find_by_country(params = {})
209
+ if params[:subdomain].nil?
210
+ find_by_sql("SELECT country, COUNT(*) AS total " +
211
+ "FROM rail_stats " +
212
+ "WHERE country != '' and country is not null " +
213
+ "GROUP BY country " +
214
+ "ORDER BY total DESC; ")
215
+ else
216
+ find_by_sql("SELECT country, COUNT(*) AS total " +
217
+ "FROM rail_stats " +
218
+ "WHERE country != '' and country is not null and subdomain = '#{params[:subdomain]}'" +
219
+ "GROUP BY country " +
220
+ "ORDER BY total DESC; ")
221
+ end
222
+ end
223
+
224
+ def RailStat.find_by_domain(params = {})
225
+ if params[:subdomain].nil?
226
+ find_by_sql("SELECT domain, referer, resource, COUNT(domain) AS total " +
227
+ "FROM rail_stats " +
228
+ "WHERE domain != '' " +
229
+ "GROUP BY domain, referer, resource " +
230
+ "ORDER BY total DESC; ")
231
+ else
232
+ find_by_sql("SELECT domain, referer, resource, COUNT(domain) AS total " +
233
+ "FROM rail_stats " +
234
+ "WHERE domain != '' and subdomain = '#{params[:subdomain]}'" +
235
+ "GROUP BY domain, referer, resource " +
236
+ "ORDER BY total DESC; ")
237
+ end
238
+ end
239
+
240
+ def RailStat.find_by_client(params = {})
241
+
242
+
243
+ if params[:subdomain].nil?
244
+ results = find_by_sql("SELECT #{params[:type]}, COUNT(*) AS total " +
245
+ "FROM rail_stats " +
246
+ "GROUP BY #{params[:type]} " +
247
+ "ORDER BY total DESC; ")
248
+ else
249
+ results = find_by_sql("SELECT #{params[:type]}, COUNT(*) AS total " +
250
+ "FROM rail_stats " +
251
+ "WHERE subdomain = '#{params[:subdomain]}'" +
252
+ "GROUP BY #{params[:type]} " +
253
+ "ORDER BY total DESC; ")
254
+ end
255
+ end
256
+ end
@@ -11,9 +11,11 @@ class SearchTerm < ActiveRecord::Base
11
11
  end
12
12
  end
13
13
 
14
- def self.find_grouped(subdomain)
15
- sts = []
16
- connection.select_all("select searchterms, sum(count) as count from search_terms where subdomain = '#{subdomain}' group by domain order by 2 desc;").each { |row| sts << row }
17
- sts
14
+ def self.find_grouped(params = {})
15
+ if params[:subdomain].nil?
16
+ SearchTerm.find_by_sql("SELECT searchterms, COUNT(*) AS total FROM search_terms GROUP BY domain, searchterms, count ORDER BY count DESC;")
17
+ else
18
+ SearchTerm.find_by_sql("SELECT searchterms, COUNT(*) AS total FROM search_terms WHERE subdomain = '#{params[:subdomain]}' GROUP BY domain, searchterms, count ORDER BY count DESC;")
19
+ end
18
20
  end
19
21
  end
@@ -1,27 +1,38 @@
1
1
  <h1> Statistic on web hits for <%%= @subdomain %> </h1>
2
2
  <%%=render_partial 'menu'%>
3
- <h2>Last week hits</h2>
4
- <div id="path_stats_lw">
5
- <table class="list">
6
- <tr><th>Date</th><th>Hits</th></tr>
7
- <%% initListClass
8
- for day in @lastweek %>
9
- <tr class="<%%=popListClass%>">
10
- <td><%%=day['hdate']%></td>
11
- <td><%%=day['hits']%></td>
12
- </tr>
13
- <%% end %>
14
- </table>
15
- </div>
16
3
 
17
- <h2>Hits summary</h2>
4
+
5
+ <h2>Hits Summary</h2>
18
6
  <div id="path_stats_hs">
19
7
  <table class="list">
20
- <tr><th>Totals</th><th>Uniques</th></tr>
21
- <tr class="even"><td colspan="2">From <%%=@first_hit.datetime%></td></tr>
22
- <tr class="odd"><td><%%=@total_hits%></td><td><%%=@unique_hits%></td></tr>
23
- <tr class="even"><td colspan="2">Only on <%%=Time.now%></td></tr>
24
- <tr class="odd"><td><%%=@today_total%></td><td><%%=@today_unique%></td></tr>
8
+ <tr>
9
+ <th>Time Period</th>
10
+ <th>Total Hits</th>
11
+ <th>Unique Hits</th>
12
+ </tr>
13
+ <tr class='<%%= alternator %>'>
14
+ <td>Today</td>
15
+ <td><%%= @today_total %></td>
16
+ <td><%%= @today_unique %></td>
17
+ </tr>
18
+ <tr class='<%%= alternator %>'>
19
+ <td>Past 7 Days</td>
20
+ <td><%%= @past_7_total %></td>
21
+ <td><%%= @past_7_unique %></td>
22
+ </tr>
23
+ <%% for day in @lastweek -%>
24
+ <tr class='<%%= alternator %>'>
25
+ <td>&nbsp;&nbsp;<%%=day['created_on']%></td>
26
+ <td><%%=day['total_hits']%></td>
27
+ <td><%%=day['unique_hits']%></td>
28
+ </tr>
29
+ <%% end -%>
30
+ <tr class='<%%= alternator %>'>
31
+ <td>Since <%%= @first_hit.datetime %></td>
32
+ <td><%%= @total_hits %></td>
33
+ <td><%%= @unique_hits %></td>
34
+ </tr>
35
+
25
36
  </table>
26
37
  </div>
27
38
  </div>
@@ -3,23 +3,35 @@
3
3
  <h2>Languages</h2>
4
4
  <div id="path_stats_lang">
5
5
  <table class="list">
6
- <tr><th>Language</th><th>%</th></tr>
7
- <%% initListClass
8
- for row in @languages %>
9
- <tr class="<%%=popListClass%>"><td><%%=get_lang(row['language'])%></td><td><%%=row['percent']%>%</td></tr>
10
- <%% end %>
6
+ <tr>
7
+ <th>Language</th>
8
+ <th>Percentage</th>
9
+ <th>Hit Count</th>
10
+ </tr>
11
+ <%% for language in @languages %>
12
+ <tr class='<%%= alternator %>'>
13
+ <td><%%= get_lang(language.language) %></td>
14
+ <td><%%= sprintf("%000.2f", (language.total.to_f/@total_hits)*100) %>%</td>
15
+ <td><%%= language.total %></td>
16
+ </tr>
17
+ <%% end %>
11
18
  </table>
12
19
  </div>
13
20
 
14
21
  <h2>Countries</h2>
15
22
  <div id="path_stats_country">
16
23
  <table class="list">
17
- <tr><th>Country</th><th>%</th></tr>
18
- <%% initListClass
19
- for row in @countries %>
20
- <tr class="<%%=popListClass%>"><td><%%=row['country']%></td><td><%%=row['percent']%>%</td></tr>
21
- <%% end %>
24
+ <tr>
25
+ <th>Country</th>
26
+ <th>Percentage</th>
27
+ <th>Hit Count</th>
28
+ </tr>
29
+ <%% for country in @countries %>
30
+ <tr class="<%%= alternator %>">
31
+ <td><%%= country.country %></td>
32
+ <td><%%= sprintf("%000.2f", (language.total.to_f/@total_hits)*100) %>%</td>
33
+ <td><%%= country.total %></td>
34
+ </tr>
35
+ <%% end %>
22
36
  </table>
23
37
  </div>
24
- </div>
25
- </div>
@@ -3,48 +3,73 @@
3
3
  <h2>Flash supported</h2>
4
4
  <div id="path_stats_flash">
5
5
  <table class="list">
6
- <tr><th width='50%'>Version</th><th>Percentage</th></tr>
7
- <%% initListClass
8
- for data in @flashes %>
9
- <tr class="<%%=popListClass%>"><td><%%=path_version_data(data['flash'])%></td><td><%%=data['percent']%> %</td></tr>
10
- <%% end %>
6
+ <tr>
7
+ <th width='50%'>Version</th>
8
+ <th>Percentage</th>
9
+ </tr>
10
+ <%% for flash_client in @flash_clients %>
11
+ <tr class="<%%= alternator %>">
12
+ <td><%%= path_version_data(flash_client['flash']) %></td>
13
+ <td><%%= sprintf("%000.2f", (flash_client.total.to_f/@flash_clients_total)*100) %> %</td>
14
+ </tr>
15
+ <%% end %>
11
16
  </table>
12
17
  </div>
13
18
 
14
19
  <h2>JavaVM Enabled</h2>
15
20
  <table class="list">
16
- <tr><th width='50%'>Version</th><th>Percentage</th></tr>
17
- <%% initListClass
18
- for data in @jes %>
19
- <tr class="<%%=popListClass%>"><td><%%=path_version_data(data['java_enabled'])%></td><td><%%=data['percent']%> %</td></tr>
20
- <%% end %>
21
+ <tr>
22
+ <th width='50%'>Version</th>
23
+ <th>Percentage</th>
24
+ </tr>
25
+ <%% for java_client in @java_clients %>
26
+ <tr class="<%%= alternator %>">
27
+ <td><%%= path_version_data(java_client['java_enabled']) %></td>
28
+ <td><%%= sprintf("%000.2f", (java_client.total.to_f/@java_clients_total)*100) %> %</td>
29
+ </tr>
30
+ <%% end %>
21
31
  </table>
22
32
 
23
33
  <h2>Javascript suported</h2>
24
34
  <table class="list">
25
- <tr><th width='50%'>JavaScript</th><th>Percentage</th></tr>
26
- <%% initListClass
27
- for data in @javas %>
28
- <tr class="<%%=popListClass%>"><td><%%=path_version_data(data['java'])%></td><td><%%=data['percent']%> %</td></tr>
35
+ <tr>
36
+ <th width='50%'>JavaScript</th>
37
+ <th>Percentage</th>
38
+ </tr>
39
+ <%% for javascript_client in @javascript_clients %>
40
+ <tr class="<%%= alternator %>">
41
+ <td><%%= path_version_data(javascript_client['java']) %></td>
42
+ <td><%%= sprintf("%000.2f", (javascript_client.total.to_f/@javascript_clients_total)*100) %> %</td>
43
+ </tr>
29
44
  <%% end %>
30
45
  </table>
31
46
 
32
47
  <h2>Screen width</h2>
33
48
  <table class="list">
34
- <tr><th width='50%'>Width</th><th>Percentage</th></tr>
35
- <%% initListClass
36
- for data in @widths %>
37
- <tr class="<%%=popListClass%>"><td><%%=path_version_data(data['screen_size'])%></td><td><%%=data['percent']%> %</td></tr>
38
- <%% end %>
49
+ <tr>
50
+ <th width='50%'>Width</th>
51
+ <th>Percentage</th>
52
+ </tr>
53
+ <%% for width_of_client in @width_of_clients %>
54
+ <tr class="<%%= alternator %>">
55
+ <td><%%= path_version_data(width_of_client['screen_size']) %></td>
56
+ <td><%%= sprintf("%000.2f", (width_of_client.total.to_f/@width_of_clients_total)*100) %> %</td>
57
+ </tr>
58
+ <%% end %>
39
59
  </table>
40
60
 
41
61
  <h2>Color depth</h2>
42
62
  <table class="list">
43
- <tr><th width='50%'>Color depth</th><th>Percentage</th></tr>
44
- <%% initListClass
45
- for data in @colors %>
46
- <tr class="<%%=popListClass%>"><td><%%=path_version_data(data['colors'])%></td><td><%%=data['percent']%> %</td></tr>
47
- <%% end %>
63
+ <tr>
64
+ <th width='50%'>Color depth</th>
65
+ <th>Percentage</th>
66
+ </tr>
67
+ <%% for colors_of_client in @colors_of_clients %>
68
+ <tr class="<%%= alternator %>">
69
+ <td><%%= path_version_data(colors_of_client['colors']) %></td>
70
+ <td><%%= sprintf("%000.2f", (colors_of_client.total.to_f/@colors_of_clients_total)*100) %> %</td>
71
+ </tr>
72
+ <%% end %>
48
73
  </table>
49
74
 
50
75
  </div>