Adjust attribute names

This commit is contained in:
Maximilian Grundke
2018-03-14 08:42:49 +01:00
parent 68d3fd174e
commit 1bf2757c44
2 changed files with 10 additions and 10 deletions

View File

@ -24,12 +24,12 @@ module StatisticsHelper
[ [
{ {
key: 'internal_users', key: 'internal_users',
title: t('activerecord.models.internal_user.other'), name: t('activerecord.models.internal_user.other'),
data: InternalUser.count data: InternalUser.count
}, },
{ {
key: 'external_users', key: 'external_users',
title: t('activerecord.models.external_user.other'), name: t('activerecord.models.external_user.other'),
data: ExternalUser.count data: ExternalUser.count
} }
] ]
@ -39,12 +39,12 @@ module StatisticsHelper
[ [
{ {
key: 'exercises', key: 'exercises',
title: t('activerecord.models.exercise.other'), name: t('activerecord.models.exercise.other'),
data: Exercise.count data: Exercise.count
}, },
{ {
key: 'average_submissions', key: 'average_submissions',
title: t('statistics.entries.exercises.average_number_of_submissions'), name: t('statistics.entries.exercises.average_number_of_submissions'),
data: Submission.count / Exercise.count data: Submission.count / Exercise.count
} }
] ]
@ -54,18 +54,18 @@ module StatisticsHelper
[ [
{ {
key: 'rfcs', key: 'rfcs',
title: t('activerecord.models.request_for_comment.other'), name: t('activerecord.models.request_for_comment.other'),
data: RequestForComment.count data: RequestForComment.count
}, },
{ {
key: 'percent_solved', key: 'percent_solved',
title: t('statistics.entries.request_for_comments.percent_solved'), name: t('statistics.entries.request_for_comments.percent_solved'),
data: (100.0 / RequestForComment.count * RequestForComment.where(solved: true).count).round(2), data: (100.0 / RequestForComment.count * RequestForComment.where(solved: true).count).round(2),
unit: '%' unit: '%'
}, },
{ {
key: 'comments', key: 'comments',
title: t('activerecord.models.comment.other'), name: t('activerecord.models.comment.other'),
data: Comment.count data: Comment.count
}, },
] ]

View File

@ -2,8 +2,8 @@
#statistics-container #statistics-container
- statistics_data.each do | section | - statistics_data.each do | section |
h2 = section[:name] h2 = section[:name]
.statistics-wrapper .statistics-wrapper data-key=section[:key]
- section[:entries].each do | entry | - section[:entries].each do | entry |
div div data-key=entry[:key]
.title = entry[:title] .title = entry[:name]
.data = entry[:data].to_s + (entry[:unit] or '') .data = entry[:data].to_s + (entry[:unit] or '')