admin: new page to see score details
This commit is contained in:
parent
4a4d0f634a
commit
024ae04f45
@ -49,6 +49,10 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"])
|
||||
controller: "TeamController",
|
||||
templateUrl: "views/team-stats.html"
|
||||
})
|
||||
.when("/teams/:teamId/score", {
|
||||
controller: "TeamController",
|
||||
templateUrl: "views/team-score.html"
|
||||
})
|
||||
.when("/public/:screenId", {
|
||||
controller: "PublicController",
|
||||
templateUrl: "views/public.html"
|
||||
@ -182,6 +186,9 @@ angular.module("FICApp")
|
||||
.factory("TeamHistory", function($resource) {
|
||||
return $resource("/api/teams/:teamId/history.json", { teamId: '@id' })
|
||||
})
|
||||
.factory("TeamScore", function($resource) {
|
||||
return $resource("/api/teams/:teamId/score-grid.json", { teamId: '@id' })
|
||||
})
|
||||
.factory("TeamStats", function($resource) {
|
||||
return $resource("/api/teams/:teamId/stats.json", { teamId: '@id' })
|
||||
})
|
||||
@ -1379,6 +1386,9 @@ angular.module("FICApp")
|
||||
$scope.showStats = function() {
|
||||
$location.url("/teams/" + $scope.team.id + "/stats");
|
||||
}
|
||||
$scope.showScore = function() {
|
||||
$location.url("/teams/" + $scope.team.id + "/score");
|
||||
}
|
||||
})
|
||||
.controller("TeamHistoryController", function($scope, TeamHistory, $routeParams, $http, $rootScope) {
|
||||
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
|
||||
@ -1395,6 +1405,11 @@ angular.module("FICApp")
|
||||
});
|
||||
}
|
||||
})
|
||||
.controller("TeamScoreController", function($scope, TeamScore, TeamMy, Exercice, $routeParams) {
|
||||
$scope.scores = TeamScore.query({ teamId: $routeParams.teamId });
|
||||
$scope.my = TeamMy.get({ teamId: $routeParams.teamId });
|
||||
$scope.exercices = Exercice.query();
|
||||
})
|
||||
.controller("TeamStatsController", function($scope, TeamStats, $routeParams) {
|
||||
$scope.teamstats = TeamStats.get({ teamId: $routeParams.teamId });
|
||||
$scope.teamstats.$promise.then(function(res) {
|
||||
|
@ -1,6 +1,9 @@
|
||||
<h1>
|
||||
{{ team.name }}
|
||||
<button type="button" ng-click="showStats()" class="float-right btn btn- btn-primary" ng-if="team.id">
|
||||
<button type="button" ng-click="showScore()" class="float-right btn btn-primary mr-1" ng-if="team.id">
|
||||
Score
|
||||
</button>
|
||||
<button type="button" ng-click="showStats()" class="float-right btn btn-primary mr-1" ng-if="team.id">
|
||||
<span class="glyphicon glyphicon-list" aria-hidden="true"></span>
|
||||
Statistiques
|
||||
</button>
|
||||
@ -98,7 +101,7 @@
|
||||
<tbody>
|
||||
<tr ng-repeat="row in history" ng-class="{'bg-ffound': row.kind == 'flag_found', 'bg-mfound': row.kind == 'mcq_found', 'bg-wchoices': row.kind == 'wchoices', 'bg-success': row.kind == 'solved', 'bg-info': row.kind == 'hint', 'bg-warning': row.kind == 'tries'}">
|
||||
<td>
|
||||
<nobr>{{ row.time | date:"mediumTime" }}</nobr><br>{{ row.kind }}
|
||||
<nobr title="{{ row.time }}">{{ row.time | date:"mediumTime" }}</nobr><br>{{ row.kind }}
|
||||
</td>
|
||||
<td>
|
||||
<span ng-if="row.primary_title">
|
||||
|
39
admin/static/views/team-score.html
Normal file
39
admin/static/views/team-score.html
Normal file
@ -0,0 +1,39 @@
|
||||
<h1>
|
||||
<a href="teams/{{team.id}}">{{ team.name }}</a>
|
||||
<small class="text-muted">Détails des scores</small>
|
||||
</h1>
|
||||
|
||||
<p><input type="search" class="form-control" placeholder="Search" ng-model="query" autofocus></p>
|
||||
<table ng-controller="TeamScoreController" class="table table-hover table-striped table-bordered bg-dark text-light">
|
||||
<thead>
|
||||
<th>Exercice</th>
|
||||
<th>Raison</th>
|
||||
<th>Points</th>
|
||||
<th>Calcul</th>
|
||||
<th>Date</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="row in scores | filter: query | orderBy:'time'" ng-class="{'bg-ffound': row.reason == 'First blood', 'bg-wchoices': row.reason == 'Display choices', 'bg-success': row.reason == 'Validation', 'bg-info': row.reason == 'Hint', 'bg-warning': row.reason == 'Tries'}">
|
||||
<td>
|
||||
<a ng-repeat="exercice in exercices" ng-if="exercice.id == row.id_exercice" href="exercices/{{ row.id_exercice }}">{{ exercice.title }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ row.reason }}
|
||||
</td>
|
||||
<td>
|
||||
{{ row.points * row.coeff }}
|
||||
</td>
|
||||
<td>
|
||||
{{ row.points }} * {{ row.coeff }}
|
||||
</td>
|
||||
<td>
|
||||
<nobr title="{{ row.time }}">{{ row.time | date:"mediumTime" }}</nobr>
|
||||
</td>
|
||||
</tr>
|
||||
<tfoot>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>{{ my.score }}</th>
|
||||
</thead>
|
||||
</tbody>
|
||||
</table>
|
Loading…
Reference in New Issue
Block a user