mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 21:54:42 +08:00
FEATURE: displays average for 2 columns tables which support average
This commit is contained in:
@ -31,6 +31,16 @@ export default Ember.Component.extend({
|
|||||||
return reportTotal && total && twoColumns;
|
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")
|
@computed("model.data.length")
|
||||||
showSortingUI(dataLength) {
|
showSortingUI(dataLength) {
|
||||||
return dataLength >= 5;
|
return dataLength >= 5;
|
||||||
|
@ -48,6 +48,18 @@
|
|||||||
<td class="admin-report-table-cell number y">{{number model.total}}</td>
|
<td class="admin-report-table-cell number y">{{number model.total}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -3111,6 +3111,7 @@ en:
|
|||||||
groups: "All groups"
|
groups: "All groups"
|
||||||
disabled: "This report is disabled"
|
disabled: "This report is disabled"
|
||||||
totals_for_sample: "Totals for sample"
|
totals_for_sample: "Totals for sample"
|
||||||
|
average_for_sample: "Average for sample"
|
||||||
total: "All time total"
|
total: "All time total"
|
||||||
no_data: "No data to display."
|
no_data: "No data to display."
|
||||||
trending_search:
|
trending_search:
|
||||||
|
Reference in New Issue
Block a user