Can have a work without submission

This commit is contained in:
nemunaire 2022-09-05 10:16:25 +02:00
parent 8b0043dc8d
commit 0079901311
2 changed files with 76 additions and 57 deletions

View File

@ -9,16 +9,26 @@
export let work = null;
</script>
{#if work.submission_url}
{#if work.submission_url == '-'}
<!-- Display nothing -->
{:else if work.submission_url}
{#await getUserRendu(work.submission_url, $user)}
<div class="spinner-border spinner-border-sm" role="status"></div>
{:then rendu}
{#if rendu === null}
<i class="bi text-danger bi-exclamation-circle-fill" title="Rendu non réceptionné"></i>
{:else}
<i class="bi text-success bi-check" title={"Rendu effectué : " + JSON.stringify(rendu)}></i>
<i class="bi text-success bi-check-circle-fill" title={"Rendu effectué : " + JSON.stringify(rendu)}></i>
{/if}
{:catch error}
<i class="bi text-warning bi-exclamation-triangle-fill" title={error}></i>
{/await}
{:else}
{#await work.getSubmission()}
<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>
{:catch error}
<i class="bi text-warning bi-exclamation-triangle-fill" title={error}></i>
{/await}
{/if}

View File

@ -104,28 +104,30 @@
<dd><DateFormat date={new Date(w.start_availability)} dateStyle="medium" timeStyle="medium" /></dd>
<dt>Date de fin</dt>
<dd><DateFormat date={new Date(w.end_availability)} dateStyle="medium" timeStyle="medium" /></dd>
<dt>Rendu&nbsp;?</dt>
<dd>
{#if w.submission_url}
<SubmissionStatus work={w} />
{:else}
{#await my_submission}
<div class="spinner-grow spinner-grow-sm mx-1" role="status"></div>
{:then submission}
<i
class="bi bi-check-circle text-success"
title="Oui !"
></i>
<DateFormat date={new Date(submission.date)} dateStyle="medium" timeStyle="medium" />
{:catch}
<i
class="bi bi-x-circle text-danger"
title="Pas de rendu trouvé"
></i>
Non
{/await}
{/if}
</dd>
{#if w.submission_url != "-"}
<dt>Rendu&nbsp;?</dt>
<dd>
{#if w.submission_url}
<SubmissionStatus work={w} />
{:else}
{#await my_submission}
<div class="spinner-grow spinner-grow-sm mx-1" role="status"></div>
{:then submission}
<i
class="bi bi-check-circle text-success"
title="Oui !"
></i>
<DateFormat date={new Date(submission.date)} dateStyle="medium" timeStyle="medium" />
{:catch}
<i
class="bi bi-x-circle text-danger"
title="Pas de rendu trouvé"
></i>
Non
{/await}
{/if}
</dd>
{/if}
</dl>
{#if w.description}
<hr>
@ -136,7 +138,7 @@
<h3 class="mt-3">Rendu</h3>
{#if !w.corrected}
{#if !w.corrected && w.submission_url != "-"}
<p>
Pour rendre votre travail, vous devez préalablement créer un dépôt Git sur la <a href="https://gitlab.cri.epita.fr/" target="_blank">forge de l'école</a>.<br>Ce dépôt DOIT&nbsp;:
</p>
@ -155,41 +157,44 @@
{/if}
{/if}
<WorkRepository class="mb-3" readonly={w.corrected || new Date(w.end_availability) <= new Date()} work={w} on:update_submission={() => refresh_submission(w)} />
<div class="card mb-3">
<div class="card-body d-flex justify-content-between">
<div>
{#if w.submission_url}
<strong>État du rendu&nbsp;:</strong> <SubmissionStatus work={w} />
{:else}
Rendu&nbsp;:
{#await my_submission}
<div class="spinner-grow spinner-grow-sm mx-1" role="status"></div>
{:then submission}
<strong>{submission.commit} ({submission.tag})</strong> (taille&nbsp;: {submission.size}&nbsp;o, date&nbsp;: <DateFormat date={new Date(submission.date)} dateStyle="medium" timeStyle="medium" />)
{#if w.submission_url != "-"}
<WorkRepository class="mb-3" readonly={w.corrected || new Date(w.end_availability) <= new Date()} work={w} on:update_submission={() => refresh_submission(w)} />
<div class="card mb-3">
<div class="card-body d-flex justify-content-between">
<div>
{#if w.submission_url}
<strong>État du rendu&nbsp;:</strong> <SubmissionStatus work={w} />
{:else}
Rendu&nbsp;:
{#await my_submission}
<div class="spinner-grow spinner-grow-sm mx-1" role="status"></div>
{:then submission}
<strong>{submission.commit} ({submission.tag})</strong> (taille&nbsp;: {submission.size}&nbsp;o, date&nbsp;: <DateFormat date={new Date(submission.date)} dateStyle="medium" timeStyle="medium" />)
{:catch}
<strong>-</strong>
{/await}
{/if}
</div>
<div class="d-flex flex-column justify-content-center">
{#await my_submission then submission}
<a
href="/api/works/{w.id}/download"
class="btn btn-sm btn-dark"
title="Voir la tarball de mon rendu"
>
<i class="bi bi-download"></i>
</a>
{:catch}
<strong>-</strong>
<i
class="bi bi-x-circle text-danger"
title="Pas de rendu trouvé"
></i>
{/await}
{/if}
</div>
<div class="d-flex flex-column justify-content-center">
{#await my_submission then submission}
<a
href="/api/works/{w.id}/download"
class="btn btn-sm btn-dark"
title="Voir la tarball de mon rendu"
>
<i class="bi bi-download"></i>
</a>
{:catch}
<i
class="bi bi-x-circle text-danger"
title="Pas de rendu trouvé"
></i>
{/await}
</div>
</div>
</div>
</div>
{/if}
{#if w.corrected}
{#await getScore(w)}
<div class="spinner-border spinner-border-sm" role="status"></div>
@ -204,10 +209,14 @@
<strong>{error.message}</strong>
</div>
{/await}
{:else}
{:else if w.submission_url != "-"}
<div class="alert alert-warning">
Pour être reconnu, vous devez pousser un tag <strong><a href="keys">signé</a></strong> sur votre dépôt. {#if w.tag}Le tag attendu doit commencer par&nbsp;: <code>{w.tag}</code>. Par exemple <code>{w.tag}v1.0</code>, <code>{w.tag}v1.1</code>, &hellip;{/if} Seul le dernier tag <strong>alphabétique</strong> que vous envoyez avant la date du rendu sera pris en compte. Vous pouvez donc faire autant de tag que vous le souhaitez d'ici la date du rendu.
</div>
{:else}
<div class="alert alert-primary">
Ce travail n'a pas de modalité de rendu.
</div>
{/if}
{/if}
{/await}