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