Fix mean calculation
Some checks are pending
continuous-integration/drone/push Build is running

This commit is contained in:
nemunaire 2022-09-20 19:47:32 +02:00
parent 57d37544f9
commit 2365674a97

View File

@ -63,7 +63,7 @@
</thead> </thead>
<tbody ng-controller="SurveyGradesController"> <tbody ng-controller="SurveyGradesController">
{#each questions as question (question.id)} {#each questions as question (question.id)}
<tr ng-click="showResponses()" ng-controller="ResponsesController"> <tr>
<td><a href="surveys/{survey.id}/responses/{question.id}">{question.title}</a></td> <td><a href="surveys/{survey.id}/responses/{question.id}">{question.title}</a></td>
{#await question.getResponses()} {#await question.getResponses()}
<td colspan="2" class="text-center"> <td colspan="2" class="text-center">
@ -81,7 +81,7 @@
</td> </td>
<td> <td>
{#if responses && responses.filter((r) => r.time_scored).length} {#if responses && responses.filter((r) => r.time_scored).length}
{responses.reduce((p, c) => (p + c.score?c.score:0), 0)/responses.filter((r) => r.time_scored).length} {Math.trunc(responses.reduce((p, c) => (p + (c.score?c.score:0)), 0)/responses.filter((r) => r.time_scored).length*10)/10}&nbsp;%
{:else} {:else}
--&nbsp;% --&nbsp;%
{/if} {/if}
@ -90,12 +90,6 @@
</tr> </tr>
{/each} {/each}
</tbody> </tbody>
<tfoot>
<tr>
<th colspan="2">Moyenne</th>
<th><!--{mean}-->&nbsp;%</th>
</tr>
</tfoot>
</table> </table>
</div> </div>
{/await} {/await}