mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
FEATURE: displays average for 2 columns tables which support average
This commit is contained in:
parent
c9a34aa10c
commit
b79d02ff48
@ -31,6 +31,16 @@ export default Ember.Component.extend({
|
||||
return reportTotal && total && twoColumns;
|
||||
},
|
||||
|
||||
@computed("model.average", "totalsForSample.1.value", "twoColumns")
|
||||
showAverage(reportAverage, totalValue, twoColumns) {
|
||||
return reportAverage && totalValue && twoColumns;
|
||||
},
|
||||
|
||||
@computed("totalsForSample.1.value", "model.data.length")
|
||||
averageForSample(totals, count) {
|
||||
return (totals / count).toFixed(0);
|
||||
},
|
||||
|
||||
@computed("model.data.length")
|
||||
showSortingUI(dataLength) {
|
||||
return dataLength >= 5;
|
||||
|
@ -48,6 +48,18 @@
|
||||
<td class="admin-report-table-cell number y">{{number model.total}}</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
|
||||
{{#if showAverage}}
|
||||
<tr class="total-row">
|
||||
<td colspan="2">
|
||||
{{i18n 'admin.dashboard.reports.average'}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="admin-report-table-row">
|
||||
<td class="admin-report-table-cell date x">—</td>
|
||||
<td class="admin-report-table-cell number y">{{number averageForSample}}</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -3111,6 +3111,7 @@ en:
|
||||
groups: "All groups"
|
||||
disabled: "This report is disabled"
|
||||
totals_for_sample: "Totals for sample"
|
||||
average_for_sample: "Average for sample"
|
||||
total: "All time total"
|
||||
no_data: "No data to display."
|
||||
trending_search:
|
||||
|
Loading…
Reference in New Issue
Block a user