admin: Rework progression on home page

This commit is contained in:
nemunaire 2024-03-17 11:43:07 +01:00
parent c638789b61
commit b9ded53920
2 changed files with 37 additions and 7 deletions

View File

@ -1994,6 +1994,15 @@ angular.module("FICApp")
$scope.exercices[ex.id_exercice] = ex;
})
});
$scope.lenExoArray = [];
$scope.themes.$promise.then(function(themes) {
if (themes['0'] && themes['0'].exercices.length) {
var j = 0;
for (var i = themes['0'].exercices.length / 10; i >= 0; i--) {
$scope.lenExoArray.push(j++);
}
}
});
})
.controller("ExerciceStatsController", function($scope, ExerciceStats, $routeParams) {

View File

@ -44,22 +44,22 @@
<div class="row mb-3">
<div class="col-sm-7 col-md-8 col-lg-9">
<div class="card">
<div class="card" ng-controller="ExercicesStatsController">
<div class="card-header">
<h4>Progression</h4>
<h4 class="mb-0">Progression</h4>
</div>
<div style="overflow: auto;">
<table class="table table-hover table-striped table-sm mb-0" ng-controller="ExercicesStatsController">
<table class="table table-hover table-striped table-sm mb-0">
<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>
<th class="rotated" ng-repeat="(tid,th) in themes" ng-if="tid != 0"><div><a ng-href="themes/{{ th.id }}">{{ th.name }}</a></div></th>
</tr>
</thead>
<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">
<td ng-repeat="(tid,theme) in themes" ng-if="tid != 0" class="text-center text-bold">
<a ng-href="exercices/{{ exercices[theme.exercices[lvl-1].id].id_exercice }}" ng-if="exercices[theme.exercices[lvl-1].id].team_tries || lvl == 1" ng-class="{'text-primary': exercices[theme.exercices[lvl-1].id].solved_count == 0, 'text-success': exercices[theme.exercices[lvl-1].id].solved_count >= 1, 'text-bold': exercices[theme.exercices[lvl-1].id].solved_count >= 1, 'text-warning': exercices[theme.exercices[lvl-1].id].solved_count == 0 && exercices[theme.exercices[lvl-1].id].team_tries}">
<span ng-if="exercices[theme.exercices[lvl-1].id].solved_count">{{ exercices[theme.exercices[lvl-1].id].solved_count }}</span>
<span ng-if="!exercices[theme.exercices[lvl-1].id].solved_count">{{ exercices[theme.exercices[lvl-1].id].team_tries }}</span>
@ -69,14 +69,35 @@
</tbody>
</table>
</div>
<div style="overflow: auto; margin-top: 10px; padding-top: 10px; border-top: solid 2px lightgrey" ng-if="themes['0']">
<table class="table table-hover table-striped table-sm mb-0">
<thead>
<tr>
<th class="text-center">Exercices</th>
<th class="text-center" ng-repeat="i in [0,1,2,3,4,5,6,7,8,9]">{{ i+1 }}</th>
</tr>
</thead>
<tbody class="table-bordered">
<tr ng-repeat="j in lenExoArray">
<th class="text-center">{{ j+1 }}</th>
<td ng-repeat="i in [0,1,2,3,4,5,6,7,8,9]" class="text-center text-bold">
<a ng-href="exercices/{{ exercices[themes[0].exercices[j*10+i].id].id_exercice }}" ng-if="!exercices[themes[0].exercices[j*10+i].id].locked" ng-class="{'text-primary': exercices[themes[0].exercices[j*10+i].id].solved_count == 0, 'text-success': exercices[themes[0].exercices[j*10+i].id].solved_count >= 1, 'text-bold': exercices[themes[0].exercices[j*10+i].id].solved_count >= 1, 'text-warning': exercices[themes[0].exercices[j*10+i].id].solved_count == 0 && exercices[themes[0].exercices[j*10+i].id].team_tries}">
<span ng-if="exercices[themes[0].exercices[j*10+i].id].solved_count">{{ exercices[themes[0].exercices[j*10+i].id].solved_count }}</span>
<span ng-if="!exercices[themes[0].exercices[j*10+i].id].solved_count">{{ exercices[themes[0].exercices[j*10+i].id].team_tries }}</span>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-sm-5 col-md-4 col-lg-3">
<div class="card">
<div class="card-header">
<h4>Classement</h4>
<h4 class="mb-0">Classement</h4>
</div>
<table class="table table-hover table-striped table-sm" ng-controller="TeamsJSONController">
<table class="table table-hover table-striped table-sm mb-0" ng-controller="TeamsJSONController">
<tbody>
<tr ng-repeat="team in rank | orderBy:'rank'" ng-if="team.rank">
<td>{{ team.rank }}</td>