diff --git a/app/models/concerns/reports/users_by_trust_level.rb b/app/models/concerns/reports/users_by_trust_level.rb index 95cda8068d1..ac2d1b94f1d 100644 --- a/app/models/concerns/reports/users_by_trust_level.rb +++ b/app/models/concerns/reports/users_by_trust_level.rb @@ -24,7 +24,7 @@ module Reports::UsersByTrustLevel ] User.real.group('trust_level').count.sort.each do |level, count| - key = TrustLevel.name(level.to_i) + key = TrustLevel.levels.key(level.to_i) url = Proc.new { |k| "/admin/users/list/#{k}" } report.data << { url: url.call(key), key: key, x: level.to_i, y: count } end diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index 1611bb76c11..1c662889fb6 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -352,6 +352,8 @@ describe Report do expect(report.data.find { |d| d[:x] == TrustLevel[0] }[:y]).to eq 3 expect(report.data.find { |d| d[:x] == TrustLevel[2] }[:y]).to eq 2 expect(report.data.find { |d| d[:x] == TrustLevel[4] }[:y]).to eq 1 + + expect(report.data.find { |d| d[:x] == TrustLevel[0] }[:url]).to eq '/admin/users/list/newuser' end end end