2022-07-08 09:53:50 +00:00
< script lang = "ts" >
import { goto } from '$app/navigation';
2022-11-18 14:38:50 +00:00
import { user } from '$lib/stores/user';
import DateFormat from '$lib/components/DateFormat.svelte';
import SubmissionStatus from '$lib/components/SubmissionStatus.svelte';
import SurveyBadge from '$lib/components/SurveyBadge.svelte';
2023-03-06 13:48:59 +00:00
import TraceStatus from '$lib/components/TraceStatus.svelte';
2022-11-18 14:38:50 +00:00
import WorkAdmin from '$lib/components/WorkAdmin.svelte';
2023-03-06 21:29:35 +00:00
import WorkGrades from '$lib/components/WorkGrades.svelte';
import WorkHeader from '$lib/components/WorkHeader.svelte';
2022-11-18 14:38:50 +00:00
import WorkRepository from '$lib/components/WorkRepository.svelte';
import { getScore } from '$lib/users';
2022-07-08 09:53:50 +00:00
2022-12-12 09:24:30 +00:00
export let data;
2022-09-04 19:43:53 +00:00
let edit = false;
2022-09-05 08:12:39 +00:00
let my_submission = null;
2022-09-30 10:41:34 +00:00
let warn_already_used = false;
2023-03-06 21:29:35 +00:00
let showSteps = false;
2022-12-12 09:24:30 +00:00
let w = null;
2022-09-05 08:12:39 +00:00
2022-12-12 09:24:30 +00:00
$: w = data.work;
$: refresh_submission(data.work);
2022-09-05 08:12:39 +00:00
function refresh_submission(w) {
my_submission = w.getSubmission();
}
2022-07-08 09:53:50 +00:00
< / script >
2022-12-12 09:24:30 +00:00
{ #if $user && $user . is_admin }
< button class = "btn btn-primary ms-1 float-end" on:click = {() => { edit = ! edit ; } } title="Éditer" >< i class = "bi bi-pencil" ></ i ></ button >
< a class = "btn btn-success ms-1 float-end" href = "works/ { w . id } /rendus" title = "Voir les rendus" >< i class = "bi bi-files" ></ i ></ a >
{ /if }
< div class = "d-flex align-items-center" >
< h2 >
< a href = "works/" class = "text-muted" style = "text-decoration: none" > < < / a >
{ w . title }
< / h2 >
< SurveyBadge class = "ms-2" survey = { w } / >
< / div >
2023-03-06 11:10:47 +00:00
{ #if $user && $user . is_admin && ( edit || w . endAvailability () < Date . now ())}
{ #if edit }
< WorkAdmin work = { w } on:saved= {() => edit = false } />
{ /if }
2022-12-12 09:24:30 +00:00
{ #if w . description }
< hr >
{ @html w . description }
2022-09-04 19:43:53 +00:00
{ /if }
2022-07-08 09:53:50 +00:00
2022-12-12 09:24:30 +00:00
< hr >
2023-03-06 21:29:35 +00:00
{ #if showSteps }
2023-03-06 11:17:12 +00:00
2023-03-06 21:29:35 +00:00
{ : else }
< WorkGrades
work={ w }
on:switch_steps={() => showSteps = true }
/>
{ /if }
2022-12-12 09:24:30 +00:00
{ :else if ( ! $user || ! $user . is_admin ) && new Date ( w . start_availability ) > new Date ()}
< div class = "alert alert-warning" >
< i class = "bi bi-stopwatch-fill" > < / i >
< strong > Ce travail n'est pas encore ouvert.< / strong > Revenez plus tard !
< / div >
{ : else }
2023-03-06 21:29:35 +00:00
< WorkHeader work = { w } { my_submission } / >
2022-12-12 09:24:30 +00:00
{ #if w . description }
2022-09-04 19:43:53 +00:00
< hr >
{ @html w . description }
2022-12-12 09:24:30 +00:00
{ /if }
< hr >
< h3 class = "mt-3" > Rendu< / h3 >
{ #if ! w . corrected && w . submission_url != "-" }
< p >
2022-12-15 14:15:38 +00:00
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" rel = "noreferrer" > forge de l'école< / a > .< br > Ce dépôt DOIT :
2022-12-12 09:24:30 +00:00
< / p >
< ul >
< li > être dans l'espace de nom de votre utilisateur (à la fin de la liste des < span class = "fst-italic" > namespaces< / span > ),< / li >
< li > avoir la visibilité « Privé »,< / li >
2022-12-15 14:15:38 +00:00
< li > avoir invité < a href = "https://gitlab.cri.epita.fr/nemunaire" target = "_blank" style = "font-family: monospace" rel = "noreferrer" > nemunaire< / a > avec le rôle < span class = "fst-italic" > Reporter< / span > une fois le dépôt créé.< / li >
2022-12-12 09:24:30 +00:00
< / ul >
{ #if w . tag }
< div class = "alert alert-info" >
< i class = "bi bi-lightbulb-fill text-info me-1" > < / i >
Vous pouvez utiliser un dépôt pour tous les travaux à effectuer, ou créer un dépôt par travail.
Son nom/slug n'a pas d'importance car c'est à vous de le sélectionner dans le formulaire ci-après.
< / div >
2022-09-04 19:43:53 +00:00
{ /if }
2022-12-12 09:24:30 +00:00
{ /if }
2022-09-04 19:43:53 +00:00
2022-12-12 09:24:30 +00:00
{ #if w . submission_url != "-" }
2023-03-06 17:24:43 +00:00
{ #if ! w . corrected }
< WorkRepository class = "mb-3" readonly = { w . corrected || new Date ( w . end_availability ) <= new Date ()} work= { w } on:update_submission = {() => refresh_submission ( w )} bind:already_used= { warn_already_used } />
{ /if }
2022-12-12 09:24:30 +00:00
< div class = "card mb-3" >
< div class = "card-body d-flex justify-content-between" >
< div >
2022-09-05 08:16:25 +00:00
{ #if w . submission_url }
2022-12-12 09:24:30 +00:00
< strong > État du rendu :</ strong > < SubmissionStatus work = { w } user= { $user } />
2022-09-05 08:16:25 +00:00
{ : else }
2022-12-12 09:24:30 +00:00
Rendu :
2022-09-05 08:16:25 +00:00
{ #await my_submission }
< div class = "spinner-grow spinner-grow-sm mx-1" role = "status" > < / div >
{ :then submission }
2023-03-06 17:46:41 +00:00
< strong >< a href = "/api/works/ { w . id } /forge/-/tree/ { submission . commit } " target = "_blank" > { submission . commit } </ a > (< a href = "/api/works/ { w . id } /forge/-/tree/ { submission . tag } " target = "_blank" > { submission . tag } </ a > )</ strong > (taille : { submission . size } o, date : < DateFormat date = { new Date ( submission . date )} dateStyle="medium" timeStyle = "medium" /> )
2022-09-05 08:16:25 +00:00
{ :catch }
2022-12-12 09:24:30 +00:00
< strong > -< / strong >
2022-09-05 08:16:25 +00:00
{ /await }
{ /if }
2022-09-04 19:43:53 +00:00
< / div >
2022-12-12 09:24:30 +00:00
< 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 }
2022-09-05 02:40:49 +00:00
< / div >
< / div >
2022-12-12 09:24:30 +00:00
< / div >
{ /if }
2022-09-05 08:16:25 +00:00
2022-12-12 09:24:30 +00:00
{ #if w . corrected }
{ #await getScore ( w )}
< div class = "spinner-border spinner-border-sm" role = "status" > < / div >
{ :then grade }
< div class = "alert alert-info" >
< i class = "bi bi-clipboard2-check-fill text-info me-1" > < / i >
< strong > Note finale :</ strong > < span title = "Établie le { grade . date } " > { grade . score } </ span > { #if grade . comment } – { grade . comment }{ /if }
< / div >
2023-03-06 13:48:59 +00:00
{ #await w . getMyTraces ()}
< div class = "spinner-border spinner-border-sm" role = "status" > < / div >
{ :then traces }
{ #each traces as trace }
< div class = "d-flex align-items-center gap-2" >
< h4 > { trace . title } </ h4 >
< TraceStatus status = { trace . status } / >
< / div >
< div class = "bg-dark text-light px-2 pt-2" >
< pre class = "pb-2" > { #each trace . logs as l ( l . pos )}{ l . out }{ /each } </ pre >
< / div >
{ /each }
{ :catch error }
< div class = "alert alert-danger" >
< i class = "bi text-warning bi-exclamation-triangle-fill" title = { error } > </i >
< strong > { error . message } </ strong >
< / div >
{ /await }
{ :catch error }
2022-12-12 09:24:30 +00:00
< div class = "alert alert-danger" >
< i class = "bi text-warning bi-exclamation-triangle-fill" title = { error } > </i >
< strong > { error . message } </ strong >
< / div >
{ /await }
{ :else if w . submission_url != "-" }
{ #if warn_already_used }
< div class = "alert alert-danger" >
< strong > Vous avez déjà utilisé ce dépôt pour rendre un autre travail.< / strong > Pour conserver ce que vous avez fait, tout en respectant l'arborescence de rendu attendue, vous devriez partir d'une nouvelle branche vide :
< pre class = "mx-2 mt-1 mb-2" >
2022-09-30 10:41:34 +00:00
42sh$ git checkout --orphan renduX
42sh$ git reset
42sh$ rm -r *
# Créez l'arborescence de rendu ensuite< / pre >
2022-12-12 09:24:30 +00:00
Pour retrouver ensuite vos rendus des travaux précédents :
< pre class = "mx-2 my-1" >
2022-09-30 10:41:34 +00:00
42sh$ git checkout renduY
-- ou --
42sh$ git checkout master
2022-12-12 09:24:30 +00:00
< / pre >
2022-09-05 08:16:25 +00:00
< / div >
2022-09-04 19:43:53 +00:00
{ /if }
2022-12-12 09:24:30 +00:00
< 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 : < code > { w . tag } </ code > . Par exemple < code > { w . tag } v1.0</ code > , < code > { w . tag } v1.1</ code > , … { /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 >
2022-07-08 09:53:50 +00:00
{ /if }
2022-12-12 09:24:30 +00:00
{ /if }
2022-09-04 19:43:53 +00:00
< div class = "mb-5" > < / div >