Add users and grades display

This commit is contained in:
nemunaire 2020-11-20 15:46:52 +01:00
commit c9d64640e2
13 changed files with 432 additions and 17 deletions

21
htdocs/views/grades.html Normal file
View file

@ -0,0 +1,21 @@
<h2>
Étudiants
<small class="text-muted">Notes</small>
</h2>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Login</th>
<th ng-repeat="(sid,survey) in surveys" ng-if="survey.corrected">{{ survey.title }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(uid,user) in users" ng-click="showUser(user)">
<td>{{ user.id }}</td>
<td>{{ user.login }}</td>
<td ng-repeat="(sid,survey) in surveys" ng-if="survey.corrected">{{ grades[user.id][survey.id] | number:2 }}</td>
</tr>
</tbody>
</table>

View file

@ -12,14 +12,19 @@
<tr>
<th>Question</th>
<th>Réponses</th>
<th></th>
<th>Moyenne</th>
</tr>
</thead>
<tbody>
<tbody ng-controller="SurveyGradesController">
<tr ng-repeat="(qid,question) in questions" ng-click="showResponses()" ng-controller="ResponsesController">
<td ng-bind="question.title"></td>
<td>{{ responses.length }}</td>
<td>{{ grades[question.id] }}&nbsp;%</td>
</tr>
<tr>
<th>Moyenne</th>
<td></td>
<th>{{ mean }}&nbsp;%</th>
</tr>
</tbody>
</table>

View file

@ -1,5 +1,5 @@
<button class="btn btn-primary ml-1 float-right" ng-click="editSurvey()" ng-if="user.is_admin && !survey.edit"><svg class="bi bi-pencil" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M13.293 3.293a1 1 0 011.414 0l2 2a1 1 0 010 1.414l-9 9a1 1 0 01-.39.242l-3 1a1 1 0 01-1.266-1.265l1-3a1 1 0 01.242-.391l9-9zM14 4l2 2-9 9-3 1 1-3 9-9z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M14.146 8.354l-2.5-2.5.708-.708 2.5 2.5-.708.708zM5 12v.5a.5.5 0 00.5.5H6v.5a.5.5 0 00.5.5H7v.5a.5.5 0 00.5.5H8v-1.5a.5.5 0 00-.5-.5H7v-.5a.5.5 0 00-.5-.5H5z" clip-rule="evenodd"></path></svg></button>
<a href="surveys/{{ survey.id }}/responses" class="btn btn-success ml-1 float-right" ng-if="user.is_admin"><svg class="bi bi-documents" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M5 4h8a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2zm0 1a1 1 0 00-1 1v10a1 1 0 001 1h8a1 1 0 001-1V6a1 1 0 00-1-1H5z" clip-rule="evenodd"></path><path d="M7 2h8a2 2 0 012 2v10a2 2 0 01-2 2v-1a1 1 0 001-1V4a1 1 0 00-1-1H7a1 1 0 00-1 1H5a2 2 0 012-2z"></path></svg></a>
<button class="btn btn-primary ml-1 float-right" ng-click="editSurvey()" title="Éditer" ng-if="user.is_admin && !survey.edit"><svg class="bi bi-pencil" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M13.293 3.293a1 1 0 011.414 0l2 2a1 1 0 010 1.414l-9 9a1 1 0 01-.39.242l-3 1a1 1 0 01-1.266-1.265l1-3a1 1 0 01.242-.391l9-9zM14 4l2 2-9 9-3 1 1-3 9-9z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M14.146 8.354l-2.5-2.5.708-.708 2.5 2.5-.708.708zM5 12v.5a.5.5 0 00.5.5H6v.5a.5.5 0 00.5.5H7v.5a.5.5 0 00.5.5H8v-1.5a.5.5 0 00-.5-.5H7v-.5a.5.5 0 00-.5-.5H5z" clip-rule="evenodd"></path></svg></button>
<a href="surveys/{{ survey.id }}/responses" class="btn btn-success ml-1 float-right" title="Voir les réponses" ng-if="user.is_admin"><svg class="bi bi-documents" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M5 4h8a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2zm0 1a1 1 0 00-1 1v10a1 1 0 001 1h8a1 1 0 001-1V6a1 1 0 00-1-1H5z" clip-rule="evenodd"></path><path d="M7 2h8a2 2 0 012 2v10a2 2 0 01-2 2v-1a1 1 0 001-1V4a1 1 0 00-1-1H7a1 1 0 00-1 1H5a2 2 0 012-2z"></path></svg></a>
<h2>
{{ survey.title }}
<small>

62
htdocs/views/user.html Normal file
View file

@ -0,0 +1,62 @@
<h2>
Étudiant
<small class="text-muted">
{{ user.login }}
</small>
</h2>
<div class="row">
<div class="offset-1 col-7">
<dl class="row">
<dt class="col-2">ID</dt>
<dd class="col-10">{{ user.id }}</dd>
<dt class="col-2">Login</dt>
<dd class="col-10">{{ user.login }}</dd>
<dt class="col-2">E-mail</dt>
<dd class="col-10"><a href="mailto:{{ user.email }}">{{ user.email }}</a></dd>
<dt class="col-2">Nom</dt>
<dd class="col-10">{{ user.lastname }}</dd>
<dt class="col-2">Prénom</dt>
<dd class="col-10">{{ user.firstname }}</dd>
<dt class="col-2">Date d'inscription</dt>
<dd class="col-10">{{ user.time }}</dd>
<dt class="col-2">Admin</dt>
<dd class="col-10">{{ user.id_admin?"Oui":"Non" }}</dd>
</dl>
</div>
<div class="col-3">
<img src="https://photos.cri.epita.fr/thumb/{{ user.login }}" alt="avatar" style="max-width: inherit; max-height: inherit">
</div>
</div>
<div class="card" ng-controller="SurveysController">
<div class="card-header">
Questionnaires
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Titre</th>
<th>Avancement</th>
<th>Note</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(sid,survey) in surveys">
<td>{{ survey.id }}</td>
<td>{{ survey.title }}</td>
<td ng-controller="UserGradesController" title="{{ grades }}">{{ avancement * 100 | number:2 }}&nbsp;%</td>
<td ng-controller="UserScoreController">{{ score.score | number:2 }}<span ng-show="score.score >= 0">/20</span></td>
</tr>
</tbody>
</table>
</div>

29
htdocs/views/users.html Normal file
View file

@ -0,0 +1,29 @@
<a href="grades" class="btn btn-success ml-1 float-right" title="Notes" ng-if="user.is_admin"><svg class="bi bi-documents" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M5 4h8a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2zm0 1a1 1 0 00-1 1v10a1 1 0 001 1h8a1 1 0 001-1V6a1 1 0 00-1-1H5z" clip-rule="evenodd"></path><path d="M7 2h8a2 2 0 012 2v10a2 2 0 01-2 2v-1a1 1 0 001-1V4a1 1 0 00-1-1H7a1 1 0 00-1 1H5a2 2 0 012-2z"></path></svg></a>
<h2>
Étudiants
</h2>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Login</th>
<th>E-mail</th>
<th>Nom</th>
<th>Prénom</th>
<th>Date d'inscription</th>
<th>admin</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(uid,user) in users" ng-click="showUser(user)">
<td>{{ user.id }}</td>
<td>{{ user.login }}</td>
<td><a href="mailto:{{ user.email }}">{{ user.email }}</a></td>
<td>{{ user.lastname }}</td>
<td>{{ user.firstname }}</td>
<td>{{ user.time }}</td>
<td>{{ user.is_admin?"Oui":"Non" }}</td>
</tr>
</tbody>
</table>