This commit is contained in:
parent
85d9f1e280
commit
73b33f9fb5
@ -1,4 +1,6 @@
|
||||
<script>
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
import DateFormat from '../components/DateFormat.svelte';
|
||||
import { getUserRendu } from '../lib/works';
|
||||
|
||||
@ -7,12 +9,32 @@
|
||||
|
||||
export let work = null;
|
||||
export let user = null;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
let renduP = null;
|
||||
let submissionP = null;
|
||||
|
||||
if (work.submission_url != '-') {
|
||||
if (work.submission_url) {
|
||||
renduP = getUserRendu(work.submission_url, user);
|
||||
renduP.then((rendu) => {
|
||||
if (rendu !== null) {
|
||||
dispatch('done');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
submissionP = work.getSubmission(user.id);
|
||||
submissionP.then((submission) => {
|
||||
dispatch('done');
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if work.submission_url == '-'}
|
||||
<!-- Display nothing -->
|
||||
{:else if work.submission_url}
|
||||
{#await getUserRendu(work.submission_url, user)}
|
||||
{#await renduP}
|
||||
<div class="spinner-border spinner-border-sm" role="status"></div>
|
||||
{:then rendu}
|
||||
{#if rendu === null}
|
||||
@ -24,7 +46,7 @@
|
||||
<i class="bi text-warning bi-exclamation-triangle-fill" title={error}></i>
|
||||
{/await}
|
||||
{:else}
|
||||
{#await work.getSubmission(user.id)}
|
||||
{#await submissionP}
|
||||
<div class="spinner-border spinner-border-sm" role="status"></div>
|
||||
{:then submission}
|
||||
<i class="bi text-success bi-check-circle-fill" title={"Rendu effectué : " + JSON.stringify(submission)}></i>
|
||||
|
@ -22,6 +22,14 @@
|
||||
import { getUsers } from '../../../lib/users';
|
||||
|
||||
export let work = null;
|
||||
let usersP = null;
|
||||
work.then((w) => {
|
||||
usersP = getUsers(w.promo, w.group);
|
||||
usersP.then((users) => { nb_users = users.length; });
|
||||
});
|
||||
|
||||
let nb_rendus = 0;
|
||||
let nb_users = 0;
|
||||
</script>
|
||||
|
||||
{#await work then w}
|
||||
@ -29,12 +37,12 @@
|
||||
<h2>
|
||||
<a href="works/{w.id}" class="text-muted" style="text-decoration: none"><</a>
|
||||
{w.title}
|
||||
<small class="text-muted">Rendus {Math.trunc(nb_rendus/nb_users*100)} % ({nb_rendus}/{nb_users})</small>
|
||||
</h2>
|
||||
<SurveyBadge class="ms-2" survey={w} />
|
||||
</div>
|
||||
|
||||
{#await getUsers(w.promo, w.group)}
|
||||
{:then users}
|
||||
{#await usersP then users}
|
||||
<table class="w-100 mb-5">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -48,7 +56,7 @@
|
||||
<tr>
|
||||
<td><a href="users/{user.login}">{user.login}</a></td>
|
||||
<td>
|
||||
<SubmissionStatus work={w} user={user} />
|
||||
<SubmissionStatus work={w} user={user} on:done={() => { nb_rendus += 1; user.show_dl_btn = true; }} />
|
||||
</td>
|
||||
<td>
|
||||
{#await getRepositories(w.id, user.id) then repos}
|
||||
@ -82,6 +90,7 @@
|
||||
<a
|
||||
href="/api/users/{user.id}/works/{w.id}/download"
|
||||
class="btn btn-sm btn-dark"
|
||||
class:disabled={!user.show_dl_btn}
|
||||
title="Télécharger la tarball du rendu"
|
||||
>
|
||||
<i class="bi bi-download"></i>
|
||||
|
Reference in New Issue
Block a user