mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-17 11:54:22 +01:00
display custom aggregations in front statistics
This commit is contained in:
parent
53dd54b175
commit
9d599a14e5
app
assets
views/api/statistics
@ -55,6 +55,9 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
|
|||||||
## total of the stat field for non simple types
|
## total of the stat field for non simple types
|
||||||
$scope.sumStat = 0
|
$scope.sumStat = 0
|
||||||
|
|
||||||
|
## Results of custom aggregations for the current type
|
||||||
|
$scope.customAggs = {}
|
||||||
|
|
||||||
## default: results are not sorted
|
## default: results are not sorted
|
||||||
$scope.sorting =
|
$scope.sorting =
|
||||||
ca: 'none'
|
ca: 'none'
|
||||||
@ -337,6 +340,7 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
|
|||||||
$scope.sumCA = 0
|
$scope.sumCA = 0
|
||||||
$scope.averageAge = 0
|
$scope.averageAge = 0
|
||||||
$scope.sumStat = 0
|
$scope.sumStat = 0
|
||||||
|
$scope.customAggs = {}
|
||||||
$scope.totalHits = null
|
$scope.totalHits = null
|
||||||
$scope.searchDate = new Date()
|
$scope.searchDate = new Date()
|
||||||
custom = buildCustomFilterQuery()
|
custom = buildCustomFilterQuery()
|
||||||
@ -350,6 +354,9 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
|
|||||||
$scope.averageAge = Math.round(res.aggregations.average_age.value * 100) / 100
|
$scope.averageAge = Math.round(res.aggregations.average_age.value * 100) / 100
|
||||||
$scope.sumStat = res.aggregations.total_stat.value
|
$scope.sumStat = res.aggregations.total_stat.value
|
||||||
$scope.scrollId = res._scroll_id
|
$scope.scrollId = res._scroll_id
|
||||||
|
for custom in $scope.type.active.custom_aggregations
|
||||||
|
$scope.customAggs[custom.field] = res.aggregations[custom.field].value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,6 +235,7 @@
|
|||||||
<li ng-show="selectedIndex.ca">{{ 'revenue_' | translate }} {{sumCA | currency}}</li>
|
<li ng-show="selectedIndex.ca">{{ 'revenue_' | translate }} {{sumCA | currency}}</li>
|
||||||
<li>{{ 'average_age' | translate }} {{averageAge}} {{ 'years_old' | translate }}</li>
|
<li>{{ 'average_age' | translate }} {{averageAge}} {{ 'years_old' | translate }}</li>
|
||||||
<li ng-if="!type.active.simple">{{ 'total' | translate }} {{type.active.label}} : {{sumStat}}</li>
|
<li ng-if="!type.active.simple">{{ 'total' | translate }} {{type.active.label}} : {{sumStat}}</li>
|
||||||
|
<li ng-repeat="custom in type.active.custom_aggregations">{{ custom.field | translate }} : {{customAggs[custom.field]}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ json.array!(@statistics) do |s|
|
|||||||
end
|
end
|
||||||
json.types s.statistic_types do |t|
|
json.types s.statistic_types do |t|
|
||||||
json.extract! t, :id, :key, :label, :graph, :simple
|
json.extract! t, :id, :key, :label, :graph, :simple
|
||||||
|
json.custom_aggregations t.statistic_custom_aggregations do |c|
|
||||||
|
json.extract! c, :id, :field
|
||||||
|
end
|
||||||
json.subtypes t.statistic_sub_types do |st|
|
json.subtypes t.statistic_sub_types do |st|
|
||||||
json.extract! st, :id, :key, :label
|
json.extract! st, :id, :key, :label
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user