Skip to content

Commit 041ad6f

Browse files
authored
Merge pull request #397 from baud123/users-stats-percentage-declared
Users stats for xmpp/mastodon: percentage % declared
2 parents a72a327 + 428ead4 commit 041ad6f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

app/models/statistics/users.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ class Statistics::Users < Statistics::Statistics
44
def pctrecent(value)
55
"%.0f%%" % (100.0 * value / nb_recently_seen_accounts)
66
end
7-
7+
8+
def pctrecent_filled(value,field)
9+
# take into account those having declared an xmpp or mastodon account
10+
"%.0f%%" % (100.0 * value / filled(field))
11+
end
12+
813
def nb_users
914
count "SELECT COUNT(*) AS cnt FROM users"
1015
end

app/views/statistics/users.html.haml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
%th Domaines à plus de trois comptes
250250
%th Nombre de comptes
251251
%th Actifs
252+
%th % déclarés
252253
- @stats.top_xmpp_domains.each do |domain|
253254
%tr
254255
%td.stat
@@ -257,6 +258,8 @@
257258
.stat.misc(style="width: #{(width_stats * domain["cnt"] / maxval).to_i}px;")= domain["cnt"]
258259
%td
259260
#{@stats.pctrecent(domain["cnt"])}
261+
%td
262+
#{@stats.pctrecent_filled(domain["cnt"],"jabber_id")}
260263

261264
%h2#stats_mastodon Domaines Mastodon
262265
%p
@@ -267,6 +270,7 @@
267270
%th Domaines à plus de trois comptes
268271
%th Nombre de comptes
269272
%th Actifs
273+
%th % déclarés
270274
- @stats.top_mastodon_domains.each do |domain|
271275
%tr
272276
%td.stat
@@ -275,6 +279,9 @@
275279
.stat.misc(style="width: #{(width_stats * domain["cnt"] / maxval).to_i}px;")= domain["cnt"]
276280
%td
277281
#{@stats.pctrecent(domain["cnt"])}
282+
%td
283+
#{@stats.pctrecent_filled(domain["cnt"],"mastodon_url")}
284+
278285

279286
%h2#stats_fonctionnalites Utilisation des fonctionnalités
280287
%p

0 commit comments

Comments
 (0)