admin: Fix summary table on home page
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b7a36f906c
commit
595318e7b1
2 changed files with 16 additions and 20 deletions
|
@ -452,6 +452,9 @@ angular.module("FICApp")
|
|||
|
||||
.run(function($rootScope, $http, $interval, Settings, $location) {
|
||||
$rootScope.$location = $location;
|
||||
$rootScope.Utils = {
|
||||
keys : Object.keys
|
||||
};
|
||||
function refresh() {
|
||||
$http.get("api/settings.json").then(function(response) {
|
||||
response.data.start = new Date(response.data.start);
|
||||
|
@ -1720,8 +1723,14 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
|
||||
.controller("ExercicesStatsController", function($scope, ExercicesStats) {
|
||||
$scope.exercices = ExercicesStats.query();
|
||||
.controller("ExercicesStatsController", function($scope, Themes, ExercicesStats) {
|
||||
$scope.themes = Themes.get();
|
||||
$scope.exercices = {};
|
||||
ExercicesStats.query().$promise.then(function (exs) {
|
||||
exs.forEach(function (ex) {
|
||||
$scope.exercices[ex.id_exercice] = ex;
|
||||
})
|
||||
});
|
||||
})
|
||||
|
||||
.controller("ExerciceStatsController", function($scope, ExerciceStats, $routeParams) {
|
||||
|
|
|
@ -32,37 +32,24 @@
|
|||
<h4>Progression</h4>
|
||||
</div>
|
||||
<div style="overflow: auto;">
|
||||
<table class="table table-hover table-striped table-sm mb-0" ng-controller="ThemesListController">
|
||||
<table class="table table-hover table-striped table-sm mb-0" ng-controller="ExercicesStatsController">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="frotated"></th>
|
||||
<th class="rotated" ng-repeat="(tid,th) in themes"><div><a ng-href="themes/{{ th.id }}">{{ th.name }}</a></div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-bordered" ng-controller="ExercicesStatsController">
|
||||
<tbody class="table-bordered">
|
||||
<tr ng-repeat="lvl in [1,2,3,4,5]">
|
||||
<th class="text-center"><nobr>Challenge {{ lvl }}</nobr></th>
|
||||
<td ng-repeat="(tid,theme) in themes" class="text-center text-bold">
|
||||
<a ng-href="exercices/{{ exercice.id_exercice }}" ng-repeat="exercice in exercices" ng-if="$index == lvl-1 && (exercice.team_tries || lvl == 1)" ng-class="{'text-primary': exercice.solved_count == 0, 'text-success': exercice.solved_count >= 1, 'text-bold': exercice.solved_count >= 1, 'text-warning': exercice.solved_count == 0 && exercice.team_tries}">
|
||||
<span ng-if="exercice.solved_count">{{ exercice.solved_count }}</span>
|
||||
<span ng-if="!exercice.solved_count">{{ exercice.team_tries }}</span>
|
||||
<a ng-href="exercices/{{ exercices[Utils.keys(theme.exercices)[lvl-1]].id_exercice }}" ng-if="exercices[Utils.keys(theme.exercices)[lvl-1]].team_tries || lvl == 1" ng-class="{'text-primary': exercices[Utils.keys(theme.exercices)[lvl-1]].solved_count == 0, 'text-success': exercices[Utils.keys(theme.exercices)[lvl-1]].solved_count >= 1, 'text-bold': exercices[Utils.keys(theme.exercices)[lvl-1]].solved_count >= 1, 'text-warning': exercices[Utils.keys(theme.exercices)[lvl-1]].solved_count == 0 && exercices[Utils.keys(theme.exercices)[lvl-1]].team_tries}">
|
||||
<span ng-if="exercices[Utils.keys(theme.exercices)[lvl-1]].solved_count">{{ exercices[Utils.keys(theme.exercices)[lvl-1]].solved_count }}</span>
|
||||
<span ng-if="!exercices[Utils.keys(theme.exercices)[lvl-1]].solved_count">{{ exercices[Utils.keys(theme.exercices)[lvl-1]].team_tries }}</span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot ng-if="s.params.total" ng-init="team={id:0}">
|
||||
<tr ng-controller="TeamController">
|
||||
<td class="text-right text-light">
|
||||
<span ng-if="s.params.kind == 'levels'"><span class="badge badge-success"> </span> Résolus</span>
|
||||
<span ng-if="s.params.kind == 'teams'">Total résolus</span><br>
|
||||
<span class="badge badge-warning"> </span> Tentatives
|
||||
</td>
|
||||
<td class="table-bordered bg-dark" ng-repeat="(tid,th) in themes" class="text-center" ng-if="mystats && s.params.themes.indexOf(tid-0) !== -1">
|
||||
<strong>{{ mystats.themes[tid].solved }}</strong><br>
|
||||
{{ mystats.themes[tid].tries }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue