Merge branch 'module/poll' into dev
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script>
|
||||
import Histogram from '../../Components/Histogram.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { api, get } from '../../urls.svelte';
|
||||
import { error, yikes } from '../../warn.svelte';
|
||||
@@ -62,25 +63,22 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each Object.entries(poll.evaluation) as [option_id,hist]}
|
||||
{#each Object.entries(poll.evaluation).sort((a,b) => b[0] - a[0]) as [avg,optionset]}
|
||||
{#each Object.entries(optionset) as [option_id,histo]}
|
||||
<tr>
|
||||
<td>
|
||||
{poll.options[option_id].name}
|
||||
</td>
|
||||
<td>
|
||||
{average(hist)}
|
||||
{(+avg).toFixed(3)}
|
||||
</td>
|
||||
<td class="histogram">
|
||||
{#each Object.entries(hist).sort((a,b) => a[0] - b[0]) as [weight,count]}
|
||||
<span style="height: {100*count/max_val(hist)}%" title={t('voted {count} times',{count:count})}>
|
||||
<span>{weight}</span>
|
||||
</span>
|
||||
{/each}
|
||||
<td>
|
||||
<Histogram data={histo} />
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
{/if}
|
||||
<span class="warn">TODO: sort by average</span>
|
||||
Reference in New Issue
Block a user