-
@@ -159,7 +111,7 @@
-
diff --git a/ui/src/lib/components/WorkRepository.svelte b/ui/src/components/WorkRepository.svelte
similarity index 74%
rename from ui/src/lib/components/WorkRepository.svelte
rename to ui/src/components/WorkRepository.svelte
index 79b5069..4c65995 100644
--- a/ui/src/lib/components/WorkRepository.svelte
+++ b/ui/src/components/WorkRepository.svelte
@@ -1,10 +1,10 @@
-
-
diff --git a/ui/src/lib/components/ScoreBadge.svelte b/ui/src/lib/components/ScoreBadge.svelte
deleted file mode 100644
index f170afe..0000000
--- a/ui/src/lib/components/ScoreBadge.svelte
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
= 18}
- class:bg-info={score < 18 && score >= 15}
- class:bg-warning={score < 15 && score >= 9}
- class:bg-danger={score < 9}
- class:bg-dark={score == "N/A"}
->
- {score}
-
diff --git a/ui/src/lib/components/SurveyBadge.svelte b/ui/src/lib/components/SurveyBadge.svelte
deleted file mode 100644
index 1b7a241..0000000
--- a/ui/src/lib/components/SurveyBadge.svelte
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-{#if survey.direct != null}
Direct
-{:else if survey.startAvailability() > Date.now()}
Prévu
-{:else if survey.endAvailability() > Date.now()}
En cours
-{:else if !survey.__start_availability}
Nouveau
-{:else if !survey.corrected}
Terminé
-{:else}
Corrigé
-{/if}
diff --git a/ui/src/lib/components/TraceStatus.svelte b/ui/src/lib/components/TraceStatus.svelte
deleted file mode 100644
index 1374c74..0000000
--- a/ui/src/lib/components/TraceStatus.svelte
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-{#if status}
-
- {status}
-
-{/if}
diff --git a/ui/src/lib/components/WorkGrades.svelte b/ui/src/lib/components/WorkGrades.svelte
deleted file mode 100644
index 5f875df..0000000
--- a/ui/src/lib/components/WorkGrades.svelte
+++ /dev/null
@@ -1,192 +0,0 @@
-
-
-
-
- Notes
-
- {#if stats.mean > 0}(moyenne : {Math.round(stats.mean*100)/100}, min : {stats.min}, max : {stats.max}){/if}
-
-
-
-
-
-
-
-
-
- {#await gradesP}
-
-
-
Chargement des notes …
-
- {:then grades}
-
-
-
- | Login |
- Note |
- Commentaire |
- Date de la note |
-
-
-
- {#if !grades}
-
- Aucune note n'a encore été envoyée pour ce travail.
-
- {:else}
- {#each grades as grade, gid (grade.id)}
-
- |
- {grade.login}
- |
- |
- {#if grade.comment}{grade.comment}{:else}-{/if} |
- {grade.date} |
-
-
-
-
-
-
-
- {#if gradationStatus[grade.id]}
- {#await gradationStatus[grade.id]}
-
- {:then status}
-
- {/await}
- {/if}
-
-
- |
-
- {/each}
- {/if}
-
-
- {/await}
-
-
-
diff --git a/ui/src/lib/components/WorkGradesSteps.svelte b/ui/src/lib/components/WorkGradesSteps.svelte
deleted file mode 100644
index b20dd4e..0000000
--- a/ui/src/lib/components/WorkGradesSteps.svelte
+++ /dev/null
@@ -1,214 +0,0 @@
-
-
-
-
- Réussite des étapes
-
-
-
-
-
-
-{#each stats as stage, istage}
-
- {stage.name}
- {stage.arch}
-
-
- {#each stage.steps as step, istep}
-
-
-
- {step.number}. {step.name}
-
-
-
- {#if step.status.filter((e) => e == "skipped").length > 0}
-
- {/if}
-
-
- {/each}
-
-{/each}
-
-{#if view_step}
-
- Étudiants correspondant
-
- {"{"}
- {stats[view_step.istage].name}
-
- {stats[view_step.istage].steps[view_step.istep].name}
- "{view_step.status}"
- {"}"}
-
-
-
- {#each Object.keys(gradationStatus) as gsi}
- {#await gradationStatus[gsi] then gs}
- {#if gs.stages[view_step.istage] && gs.stages[view_step.istage].steps[view_step.istep] && gs.stages[view_step.istage].steps[view_step.istep].status == view_step.status}
-
-
-
-
- {#each gs.stages[view_step.istage].steps as step}
- -
-
- {step.number}.
-
- {step.name}
-
- {/each}
-
-
-
-
- {/if}
- {/await}
- {/each}
-
-{/if}
diff --git a/ui/src/lib/components/WorkHeader.svelte b/ui/src/lib/components/WorkHeader.svelte
deleted file mode 100644
index 4417f90..0000000
--- a/ui/src/lib/components/WorkHeader.svelte
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
- - Date de début
-
- - Date de fin
-
- {#if work.submission_url != "-"}
- - Rendu ?
- -
- {#if work.submission_url}
-
- {:else}
- {#await my_submission}
-
- {:then submission}
-
-
- {:catch}
-
- Non
- {/await}
- {/if}
-
- {/if}
-
diff --git a/ui/src/lib/gradation.js b/ui/src/lib/gradation.js
deleted file mode 100644
index 894a4ad..0000000
--- a/ui/src/lib/gradation.js
+++ /dev/null
@@ -1,19 +0,0 @@
-export async function getGradationRepositories() {
- let url = '/api/gradation_repositories';
- const res = await fetch(url, {headers: {'Accept': 'application/json'}})
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
-}
-
-export async function syncGradationRepositories() {
- let url = '/api/gradation_repositories/sync';
- const res = await fetch(url, {method: 'post', headers: {'Accept': 'application/json'}})
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
-}
diff --git a/ui/src/lib/grades.js b/ui/src/lib/grades.js
deleted file mode 100644
index d2eb3d1..0000000
--- a/ui/src/lib/grades.js
+++ /dev/null
@@ -1,70 +0,0 @@
-export class Grade {
- constructor(res) {
- if (res) {
- this.update(res);
- }
- }
-
- update({ id, login, id_user, id_work, date, score, comment }) {
- this.id = id;
- this.login = login;
- this.id_user = id_user;
- this.id_work = id_work;
- this.date = date;
- this.score = score;
- this.comment = comment;
- }
-
- async save() {
- const res = await fetch(`api/works/${this.id_work}/grades/${this.id}`, {
- method: 'PUT',
- headers: {'Accept': 'application/json'},
- body: JSON.stringify(this),
- });
- if (res.status == 200) {
- const data = await res.json()
- this.update(data);
- return data;
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-
- async delete() {
- if (this.id) {
- const res = await fetch(`api/works/${this.id_work}/grades/${this.id}`, {
- method: 'DELETE',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return true;
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
- }
-
- async redoGradation() {
- const res = await fetch(this.id_user?`api/users/${this.id_user}/works/${this.id_work}/grades/${this.id}/traces`:`api/works/${this.id_work}/grades/${this.id}/traces`, {
- method: 'POST',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-
- async gradationStatus() {
- const res = await fetch(this.id_user?`api/users/${this.id_user}/works/${this.id_work}/grades/${this.id}/status`:`api/works/${this.id_work}/grades/${this.id}/status`, {
- method: 'GET',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-}
diff --git a/ui/src/lib/questions.js b/ui/src/lib/questions.js
index c3a02f3..53e2115 100644
--- a/ui/src/lib/questions.js
+++ b/ui/src/lib/questions.js
@@ -62,10 +62,8 @@ export class Question {
this.kind = kind;
}
- async getProposals(secret) {
- let url = `/questions/${this.id}/proposals`;
- if (secret) url = `/s/surveys/${this.id_survey}` + url + `?secret=${secret}`;
- const res = await fetch('api' + url, {
+ async getProposals() {
+ const res = await fetch(`api/questions/${this.id}/proposals`, {
method: 'GET',
headers: {'Accept': 'application/json'},
});
@@ -93,10 +91,8 @@ export class Question {
}
}
- async getResponses(secret) {
- let url = `/surveys/${this.id_survey}/questions/${this.id}/responses`;
- if (secret) url = `/s` + url + `?secret=${secret}`;
- const res = await fetch('api' + url, {
+ async getResponses() {
+ const res = await fetch(`api/surveys/${this.id_survey}/questions/${this.id}/responses`, {
method: 'GET',
headers: {'Accept': 'application/json'},
});
@@ -165,17 +161,3 @@ export async function getQuestions(sid) {
throw new Error((await res.json()).errmsg);
}
}
-
-export async function getSharedQuestions(sid, secret) {
- const res = await fetch(`api/s/surveys/${sid}/questions?secret=${secret}`, {headers: {'Accept': 'application/json'}})
- if (res.status == 200) {
- const data = await res.json();
- if (data === null) {
- return [];
- } else {
- return (data).map((q) => new Question(q))
- }
- } else {
- throw new Error((await res.json()).errmsg);
- }
-}
diff --git a/ui/src/lib/repositories.js b/ui/src/lib/repositories.js
index 2224267..2d75d6c 100644
--- a/ui/src/lib/repositories.js
+++ b/ui/src/lib/repositories.js
@@ -15,14 +15,8 @@ export class WorkRepository {
this.already_used = already_used == true;
}
- async delete(userid) {
- let url = this.id_work?`works/${this.id_work}/repositories/${this.id}`:`repositories/${this.id}`;
-
- if (userid) {
- url = `users/${userid}/` + url;
- }
-
- const res = await fetch("api/" + url, {
+ async delete() {
+ const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}`:`api/repositories/${this.id}`, {
method: 'DELETE',
headers: {'Accept': 'application/json'}
});
@@ -61,11 +55,11 @@ export class WorkRepository {
}
}
- async retrieveWork(admin_struct) {
+ async retrieveWork(tag) {
const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/trigger`:`api/repositories/${this.id}/trigger`, {
method: 'POST',
headers: {'Accept': 'application/json'},
- body: !admin_struct?{}:JSON.stringify(admin_struct)
+ body: !tag || tag.length == 0?null:JSON.stringify(tag)
});
if (res.status == 200) {
const data = await res.json();
@@ -76,30 +70,6 @@ export class WorkRepository {
}
}
- async runGradation() {
- const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/gradation`:`api/repositories/${this.id}/gradation`, {
- method: 'POST',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-
- async gradationStatus() {
- const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/gradation_status`:`api/repositories/${this.id}/gradation_status`, {
- method: 'GET',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-
async save(user) {
let url = this.id?`repositories/${this.id}`:'repositories';
diff --git a/ui/src/lib/surveys.js b/ui/src/lib/surveys.js
index 5c0c129..9e1e69f 100644
--- a/ui/src/lib/surveys.js
+++ b/ui/src/lib/surveys.js
@@ -11,9 +11,8 @@ export class Survey {
}
}
- update({ id, id_category, title, promo, group, shown, direct, corrected, start_availability, end_availability }) {
+ update({ id, title, promo, group, shown, direct, corrected, start_availability, end_availability }) {
this.id = id;
- this.id_category = id_category;
this.title = title;
this.promo = promo;
this.group = group;
@@ -73,18 +72,6 @@ export class Survey {
}
}
- async share() {
- const res = await fetch(`api/surveys/${this.id}/shares`, {
- method: 'POST',
- headers: {'Accept': 'application/json'}
- });
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-
async save() {
const res = await fetch(this.id?`api/surveys/${this.id}`:'api/surveys', {
method: this.id?'PUT':'POST',
@@ -117,35 +104,31 @@ export class Survey {
for (const q of questions) {
const oldQuestionId = q.id;
- // This will create a new question with the same parameters
delete q.id;
-
- // Also alter id_survey
q.id_survey = response.id;
+ q.save().then((question) => {
+ q.id = oldQuestionId;
- // This save will create
- const question = await q.save();
-
- // Revert to the old question ID to perform the next retrievals
- q.id = oldQuestionId;
-
- // Now recopy proposals
- if (q.kind == "mcq" || q.kind == "ucq") {
- const proposals = await q.getProposals();
- for (const p of proposals) {
- delete p.id;
- p.id_question = question.id;
- await p.save();
+ // Now recopy proposals
+ if (q.kind == "mcq" || q.kind == "ucq") {
+ q.getProposals().then((proposals) => {
+ for (const p of proposals) {
+ delete p.id;
+ p.id_question = question.id;
+ p.save();
+ }
+ });
}
- }
- // Now recopy correction templates
- const cts = await getCorrectionTemplates(oldQuestionId);
- for (const ct of cts) {
- delete ct.id;
- ct.id_question = question.id;
- ct.save();
- }
+ // Now recopy correction templates
+ getCorrectionTemplates(oldQuestionId).then((cts) => {
+ for (const ct of cts) {
+ delete ct.id;
+ ct.id_question = question.id;
+ ct.save();
+ }
+ });
+ });
}
return response;
@@ -202,12 +185,3 @@ export async function getSurvey(sid) {
throw new Error((await res.json()).errmsg);
}
}
-
-export async function getSharedSurvey(sid, secret) {
- const res = await fetch(`api/s/surveys/${sid}?secret=${secret}`, {headers: {'Accept': 'application/json'}})
- if (res.status == 200) {
- return new Survey(await res.json());
- } else {
- throw new Error((await res.json()).errmsg);
- }
-}
diff --git a/ui/src/lib/users.js b/ui/src/lib/users.js
index 4b82cde..ab10e86 100644
--- a/ui/src/lib/users.js
+++ b/ui/src/lib/users.js
@@ -19,18 +19,6 @@ export async function getUsers(promo, group) {
}
}
-export async function anonOldAccounts() {
- const res = await fetch('api/users', {
- method: 'PATCH',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return await res.json()
- } else {
- throw new Error((await res.json()).errmsg);
- }
-}
-
export class User {
constructor(res) {
if (res) {
diff --git a/ui/src/lib/works.js b/ui/src/lib/works.js
index 387d350..ba642e9 100644
--- a/ui/src/lib/works.js
+++ b/ui/src/lib/works.js
@@ -1,5 +1,3 @@
-import { Grade } from '$lib/grades';
-
export class Work {
constructor(res) {
this.kind = "w";
@@ -8,9 +6,8 @@ export class Work {
}
}
- update({ id, id_category, title, promo, group, shown, tag, description, descr_raw, submission_url, gradation_repo, corrected, start_availability, end_availability }) {
+ update({ id, title, promo, group, shown, tag, description, descr_raw, submission_url, corrected, start_availability, end_availability }) {
this.id = id;
- this.id_category = id_category;
this.title = title;
this.promo = promo;
this.group = group;
@@ -19,7 +16,6 @@ export class Work {
this.description = description;
this.descr_raw = descr_raw;
this.submission_url = submission_url;
- this.gradation_repo = gradation_repo;
this.corrected = corrected;
if (this.start_availability != start_availability) {
this.start_availability = start_availability;
@@ -95,32 +91,6 @@ export class Work {
}
}
- async stopTests() {
- if (this.id) {
- const res = await fetch(`api/works/${this.id}/tests`, {
- method: 'DELETE',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return true;
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
- }
-
- async addMissingGrades() {
- const res = await fetch(`api/works/${this.id}/grades`, {
- method: 'PATCH',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return (await res.json()).map((g) => new Grade(g));
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-
async getSubmission(uid) {
const res = await fetch(uid?`api/users/${uid}/works/${this.id}/submission`:`api/works/${this.id}/submission`, {
headers: {'Accept': 'application/json'}
@@ -132,25 +102,13 @@ export class Work {
}
}
- async getMyTraces() {
- const res = await fetch(`api/works/${this.id}/traces`, {
- method: 'GET',
- headers: {'Accept': 'application/json'},
- });
- if (res.status == 200) {
- return await res.json();
- } else {
- throw new Error((await res.json()).errmsg);
- }
- }
-
async getGrades() {
const res = await fetch(`api/works/${this.id}/grades`, {
method: 'GET',
headers: {'Accept': 'application/json'},
});
if (res.status == 200) {
- return (await res.json()).map((g) => new Grade(g));
+ return await res.json();
} else {
throw new Error((await res.json()).errmsg);
}
diff --git a/ui/src/routes/+layout.js b/ui/src/routes/+layout.js
deleted file mode 100644
index 182a4ef..0000000
--- a/ui/src/routes/+layout.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { refresh_auth, user } from '$lib/stores/user';
-
-export const ssr = false;
-
-let refresh_interval_auth = null;
-
-export async function load({ url }) {
- refresh_interval_auth = setInterval(refresh_auth, Math.floor(Math.random() * 200000) + 200000);
- refresh_auth();
-
- const rroutes = url.pathname.split('/');
-
- return {
- rroute: rroutes.length>1?rroutes[1]:'',
- };
-}
diff --git a/ui/src/routes/+layout.svelte b/ui/src/routes/__layout.svelte
similarity index 67%
rename from ui/src/routes/+layout.svelte
rename to ui/src/routes/__layout.svelte
index 3f176bc..ea091c0 100644
--- a/ui/src/routes/+layout.svelte
+++ b/ui/src/routes/__layout.svelte
@@ -1,9 +1,51 @@
-
+
+
-
-{#if $user && $user.is_admin}
-
-
-
- {#await getPromos() then promos}
-
-
-
- {/await}
-{/if}
-
- Catégories // cours
-
-
-{#await getCategories()}
-
-
-
Chargement des catégories …
-
-{:then categories}
-
-
-
- | ID |
- Nom |
- Promo |
- Étendre |
-
-
-
- {#each categories.filter((c) => (filterPromo === "" || filterPromo === c.promo)) as c (c.id)}
-
- | {c.id} |
-
- {c.label}
- |
- {c.promo} |
-
-
- {c.expand?"Oui":"Non"}
-
- |
-
- {/each}
-
-
-{/await}
diff --git a/ui/src/routes/categories/[cid]/+page.js b/ui/src/routes/categories/[cid]/+page.js
deleted file mode 100644
index 0fad514..0000000
--- a/ui/src/routes/categories/[cid]/+page.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export async function load({ params }) {
- return {
- cid: params.cid,
- };
-}
diff --git a/ui/src/routes/categories/[cid]/+page.svelte b/ui/src/routes/categories/[cid]/+page.svelte
deleted file mode 100644
index 8ecd318..0000000
--- a/ui/src/routes/categories/[cid]/+page.svelte
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-{#await categoryP then category}
-
-
- <
- {category.label}
-
-
-
- {#if $user && $user.is_admin}
-
{ goto(`categories/`)}} />
- {/if}
-{/await}
diff --git a/ui/src/routes/categories/new/+page.svelte b/ui/src/routes/categories/new/+page.svelte
deleted file mode 100644
index a35231f..0000000
--- a/ui/src/routes/categories/new/+page.svelte
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
- <
- Nouvelle catégorie
-
-
-
-{#if $user && $user.is_admin}
- { goto(`categories/${e.detail.id}`)}} />
-{/if}
diff --git a/ui/src/routes/donnees-personnelles/+page.svelte b/ui/src/routes/donnees-personnelles.svelte
similarity index 99%
rename from ui/src/routes/donnees-personnelles/+page.svelte
rename to ui/src/routes/donnees-personnelles.svelte
index 0d283f5..f887551 100644
--- a/ui/src/routes/donnees-personnelles/+page.svelte
+++ b/ui/src/routes/donnees-personnelles.svelte
@@ -131,7 +131,7 @@
Mesure d'audience
- Le site lessons.nemunai.re utilise un outil de mesure d'audience : Umami.
+ Le site lessons.nemunai.re utilise un outil de mesure d'audience : Umami.
Cet outil collecte des informations sur les pages visitées en anonymisant les données personnelles (l'IP notamment).
diff --git a/ui/src/routes/grades/+page.svelte b/ui/src/routes/grades/+page.svelte
deleted file mode 100644
index b016fbb..0000000
--- a/ui/src/routes/grades/+page.svelte
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/ui/src/routes/grades/[promo].svelte b/ui/src/routes/grades/[promo].svelte
new file mode 100644
index 0000000..8ec24ef
--- /dev/null
+++ b/ui/src/routes/grades/[promo].svelte
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/ui/src/routes/grades/[promo]/+layout.js b/ui/src/routes/grades/[promo]/+layout.js
deleted file mode 100644
index 9612920..0000000
--- a/ui/src/routes/grades/[promo]/+layout.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export async function load({ params }) {
- return {
- promo: parseInt(params.promo),
- };
-}
diff --git a/ui/src/routes/grades/[promo]/+page.svelte b/ui/src/routes/grades/[promo]/+page.svelte
deleted file mode 100644
index fd8d831..0000000
--- a/ui/src/routes/grades/[promo]/+page.svelte
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/ui/src/routes/grades/[promo]/[cid]/+page.js b/ui/src/routes/grades/[promo]/[cid]/+page.js
deleted file mode 100644
index d5640db..0000000
--- a/ui/src/routes/grades/[promo]/[cid]/+page.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export async function load({ params }) {
- return {
- promo: parseInt(params.promo),
- cid: parseInt(params.cid),
- };
-}
diff --git a/ui/src/routes/grades/[promo]/[cid]/+page.svelte b/ui/src/routes/grades/[promo]/[cid]/+page.svelte
deleted file mode 100644
index f659b04..0000000
--- a/ui/src/routes/grades/[promo]/[cid]/+page.svelte
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/ui/src/routes/grades/index.svelte b/ui/src/routes/grades/index.svelte
new file mode 100644
index 0000000..026f5ce
--- /dev/null
+++ b/ui/src/routes/grades/index.svelte
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ui/src/routes/help/+page.svelte b/ui/src/routes/help.svelte
similarity index 84%
rename from ui/src/routes/help/+page.svelte
rename to ui/src/routes/help.svelte
index b56b6b1..6b4a8c8 100644
--- a/ui/src/routes/help/+page.svelte
+++ b/ui/src/routes/help.svelte
@@ -1,6 +1,6 @@
-
-{#await surveyP then survey}
-
-
- {survey.title}
- Réponses
-
-
-
-
- {#await getSharedQuestions(survey.id, data.secret)}
-
-
-
Chargement des questions …
-
- {:then questions}
- {#each questions as question (question.id)}
- {question.title}
- {#if question.kind == "text" || (data.exportview_list && question.kind.indexOf("list") == 0)}
- {#await question.getResponses(data.secret) then responses}
- {#each responses as response (response.id)}
-
- {/each}
- {/await}
- {:else}
-
- {/if}
-
- {/each}
- {/await}
-{/await}
diff --git a/ui/src/routes/surveys/[sid]/+layout.js b/ui/src/routes/surveys/[sid]/+layout.js
deleted file mode 100644
index dfb1b6e..0000000
--- a/ui/src/routes/surveys/[sid]/+layout.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import { getSurvey } from '$lib/surveys';
-
-export async function load({ params }) {
- const survey = getSurvey(params.sid);
-
- return {
- survey,
- };
-}
diff --git a/ui/src/routes/surveys/[sid]/+page.js b/ui/src/routes/surveys/[sid]/+page.js
deleted file mode 100644
index 8a3dbdc..0000000
--- a/ui/src/routes/surveys/[sid]/+page.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export async function load({ parent }) {
- const stuff = await parent();
-
- return stuff;
-}
diff --git a/ui/src/routes/surveys/[sid]/+page.svelte b/ui/src/routes/surveys/[sid]/+page.svelte
deleted file mode 100644
index 5c44d08..0000000
--- a/ui/src/routes/surveys/[sid]/+page.svelte
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-{#if $user && $user.is_admin}
-
-
- {#if survey.direct}
-
- {/if}
-{/if}
-
-
- <
- {survey.title}
-
-
-
-
-{#if $user && $user.is_admin && edit}
- edit = false} />
-{/if}
-
-{#await getQuestions(survey.id)}
-
-
-
Chargement des questions …
-
-{:then questions}
-
-{:catch error}
-
-
-
-
-
-
-
-
-
- {#if survey.direct != null}
-
- {/if}
-{/await}
diff --git a/ui/src/routes/surveys/[sid]/+layout.svelte b/ui/src/routes/surveys/[sid]/__layout.svelte
similarity index 56%
rename from ui/src/routes/surveys/[sid]/+layout.svelte
rename to ui/src/routes/surveys/[sid]/__layout.svelte
index 0aa8134..a5acdb3 100644
--- a/ui/src/routes/surveys/[sid]/+layout.svelte
+++ b/ui/src/routes/surveys/[sid]/__layout.svelte
@@ -1,8 +1,27 @@
-
-{#await data.survey}
+
+
+{#await survey}
Chargement du questionnaire …
diff --git a/ui/src/routes/surveys/[sid]/admin.svelte b/ui/src/routes/surveys/[sid]/admin.svelte
new file mode 100644
index 0000000..1fae957
--- /dev/null
+++ b/ui/src/routes/surveys/[sid]/admin.svelte
@@ -0,0 +1,704 @@
+
+
+
+
+{#await surveyP then survey}
+ {#if $user && $user.is_admin}
+
updateSurvey()}
+ on:end={() => { if (confirm("Sûr ?")) ws.send('{"action":"end"}') }}
+ />
+
+ {/if}
+
+
+ <
+ {survey.title}
+
+ Administration
+
+ {#if asks.length}
+
+
+
+ {/if}
+
+ {#if survey.direct !== null}
+
+ {#if ws_up}Connecté{:else}Déconnecté{/if}
+
+ {:else}
+
+ {/if}
+
+
+ {#if survey.direct === null}
+
+ {:else}
+ {#await req_questions}
+
+
+
Chargement des questions …
+
+ {:then questions}
+
+ {/await}
+ {#if edit_question !== null}
+ deleteQuestion(edit_question)}
+ />
+ {/if}
+
+
+
+
+
+
+ Questions
+ {#if asks.length}
+
+ {asks.length} question{#if asks.length > 1}s{/if}
+
+ {/if}
+
+ {#if asks.length}
+ {#each asks as ask (ask.id)}
+
+ {/each}
+ {:else}
+
+ Pas de question pour l'instant.
+
+ {/if}
+
+
+
+
+ Réponses
+
+ {#if Object.keys(responses).length}
+ {#each Object.keys(responses) as q, qid (qid)}
+ {#await req_questions then questions}
+ {#each questions as question}
+ {#if question.id == q}
+
+ {question.title}
+
+ {#if question.kind == 'ucq'}
+ {#await question.getProposals()}
+
+
+
Chargement des propositions …
+
+ {:then proposals}
+ {#if current_question == question.id}
+
+ {:else}
+
+ {/if}
+
+
+
+ {#each proposals as proposal (proposal.id)}
+
+ |
+ {proposal.label}
+ |
+
+ {responsesbyid[q].filter((e) => e == proposal.id.toString()).length}/{responsesbyid[q].length}
+ |
+
+ {Math.trunc(responsesbyid[q].filter((e) => e == proposal.id.toString()).length / responsesbyid[q].length * 1000)/10} %
+ |
+
+ {/each}
+
+
+
+ {/await}
+ {:else if question.kind == 'mcq'}
+ {#await question.getProposals()}
+
+
+
Chargement des propositions …
+
+ {:then proposals}
+ {#if current_question == question.id}
+
+ {:else}
+
+ {/if}
+
+
+
+ {#each proposals as proposal (proposal.id)}
+
+ |
+ {proposal.label}
+ |
+
+ {responsesbyid[q].filter((e) => e.indexOf(proposal.id.toString()) >= 0).length}/{responsesbyid[q].length}
+ |
+
+ {Math.trunc(responsesbyid[q].filter((e) => e.indexOf(proposal.id.toString()) >= 0).length / responsesbyid[q].length * 1000)/10} %
+ |
+
+ {/each}
+
+
+
+ {/await}
+ {:else if question.kind && question.kind.startsWith('list')}
+
+ {:else}
+
+ {/if}
+ {/if}
+ {/each}
+ {/await}
+ {/each}
+ {/if}
+
+
+
+
+
+
+ Connectés
+ {#if wsstats}
+ {wsstats.nb_clients} utilisateurs
+ {/if}
+ {#if scroll_mean}
+ = 0 && scroll_mean < 0.2}
+ class:text-warning={scroll_mean >= 0.2 && scroll_mean < 0.6}
+ class:text-info={scroll_mean >= 0.6 && scroll_mean < 0.9}
+ class:text-success={scroll_mean >= 0.9}
+ >Avancement global : {Math.trunc(scroll_mean*10000)/100} %
+ {/if}
+
+ {#if wsstats && wsstats.users}
+
+ {#each wsstats.users as user, lid (lid)}
+
+
+

+
+ {#if user.myscroll != null}
+
+ {/if}
+
+
+ {/each}
+
+ {/if}
+ {/if}
+
+{/await}
diff --git a/ui/src/routes/surveys/[sid]/admin/+page.js b/ui/src/routes/surveys/[sid]/admin/+page.js
deleted file mode 100644
index abb9f2d..0000000
--- a/ui/src/routes/surveys/[sid]/admin/+page.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export async function load({ parent, params }) {
- const stuff = await parent();
-
- return {
- survey: stuff.survey,
- sid: params.sid,
- };
-}
diff --git a/ui/src/routes/surveys/[sid]/admin/+page.svelte b/ui/src/routes/surveys/[sid]/admin/+page.svelte
deleted file mode 100644
index 65cbc89..0000000
--- a/ui/src/routes/surveys/[sid]/admin/+page.svelte
+++ /dev/null
@@ -1,697 +0,0 @@
-
-
-{#if $user && $user.is_admin}
- updateSurvey()}
- on:end={() => { if (confirm("Sûr ?")) ws.send('{"action":"end"}') }}
- />
-
-{/if}
-
-
- <
- {survey.title}
-
- Administration
-
- {#if asks.length}
-
-
-
- {/if}
-
- {#if survey.direct !== null}
-
- {#if ws_up}Connecté{:else}Déconnecté{/if}
-
- {:else}
-
- {/if}
-
-
-{#if survey.direct === null}
-
-{:else}
- {#await req_questions}
-
-
-
Chargement des questions …
-
- {:then questions}
-
- {/await}
- {#if edit_question !== null}
- deleteQuestion(edit_question)}
- />
- {/if}
-
-
-
-
-
-
- Questions
- {#if asks.length}
-
- {asks.length} question{#if asks.length > 1}s{/if}
-
- {/if}
-
- {#if asks.length}
- {#each asks as ask (ask.id)}
-
- {/each}
- {:else}
-
- Pas de question pour l'instant.
-
- {/if}
-
-
-
-
- Réponses
-
- {#if Object.keys(responses).length}
- {#each Object.keys(responses) as q, qid (qid)}
- {#await req_questions then questions}
- {#each questions as question}
- {#if question.id == q}
-
- {question.title}
-
- {#if question.kind == 'ucq'}
- {#await question.getProposals()}
-
-
-
Chargement des propositions …
-
- {:then proposals}
- {#if current_question == question.id}
-
- {:else}
-
- {/if}
-
-
-
- {#each proposals as proposal (proposal.id)}
-
- |
- {proposal.label}
- |
-
- {responsesbyid[q].filter((e) => e == proposal.id.toString()).length}/{responsesbyid[q].length}
- |
-
- {Math.trunc(responsesbyid[q].filter((e) => e == proposal.id.toString()).length / responsesbyid[q].length * 1000)/10} %
- |
-
- {/each}
-
-
-
- {/await}
- {:else if question.kind == 'mcq'}
- {#await question.getProposals()}
-
-
-
Chargement des propositions …
-
- {:then proposals}
- {#if current_question == question.id}
-
- {:else}
-
- {/if}
-
-
-
- {#each proposals as proposal (proposal.id)}
-
- |
- {proposal.label}
- |
-
- {responsesbyid[q].filter((e) => e.indexOf(proposal.id.toString()) >= 0).length}/{responsesbyid[q].length}
- |
-
- {Math.trunc(responsesbyid[q].filter((e) => e.indexOf(proposal.id.toString()) >= 0).length / responsesbyid[q].length * 1000)/10} %
- |
-
- {/each}
-
-
-
- {/await}
- {:else if question.kind && question.kind.startsWith('list')}
-
- {:else}
-
- {/if}
- {/if}
- {/each}
- {/await}
- {/each}
- {/if}
-
-
-
-
-
-
- Connectés
- {#if wsstats}
- {wsstats.nb_clients} utilisateurs
- {/if}
- {#if scroll_mean}
- = 0 && scroll_mean < 0.2}
- class:text-warning={scroll_mean >= 0.2 && scroll_mean < 0.6}
- class:text-info={scroll_mean >= 0.6 && scroll_mean < 0.9}
- class:text-success={scroll_mean >= 0.9}
- >Avancement global : {Math.trunc(scroll_mean*10000)/100} %
- {/if}
-
- {#if wsstats && wsstats.users}
-
- {#each wsstats.users as user, lid (lid)}
-
-
-

-
- {#if user.myscroll != null}
-
- {/if}
-
-
- {/each}
-
- {/if}
-{/if}
diff --git a/ui/src/routes/surveys/[sid]/index.svelte b/ui/src/routes/surveys/[sid]/index.svelte
new file mode 100644
index 0000000..f9f8dda
--- /dev/null
+++ b/ui/src/routes/surveys/[sid]/index.svelte
@@ -0,0 +1,80 @@
+
+
+
+
+{#await surveyP then survey}
+ {#if $user && $user.is_admin}
+
+
+ {#if survey.direct}
+
+ {/if}
+ {/if}
+
+
+ <
+ {survey.title}
+
+
+
+
+ {#if $user && $user.is_admin && edit}
+ edit = false} />
+ {/if}
+
+ {#await getQuestions(survey.id)}
+
+
+
Chargement des questions …
+
+ {:then questions}
+
+ {:catch error}
+
+
+
+
+
+
+
+
+
+ {#if survey.direct != null}
+
+ {/if}
+ {/await}
+{/await}
diff --git a/ui/src/routes/surveys/[sid]/live.svelte b/ui/src/routes/surveys/[sid]/live.svelte
new file mode 100644
index 0000000..cee5a60
--- /dev/null
+++ b/ui/src/routes/surveys/[sid]/live.svelte
@@ -0,0 +1,302 @@
+
+
+
+
+{#await surveyP then unused}
+
+ {#if $user && $user.is_admin}
+
+
+ {/if}
+
+
+ <
+ {survey.title}
+
+
+ {#if ws_up}Connecté{:else}Déconnecté{/if}
+
+
+
+
+ {:else}
+
+ La session est terminée. On se retrouve une prochaine fois…
+
+ {/if}
+
+{/await}
diff --git a/ui/src/routes/surveys/[sid]/live/+page.js b/ui/src/routes/surveys/[sid]/live/+page.js
deleted file mode 100644
index ffc82a1..0000000
--- a/ui/src/routes/surveys/[sid]/live/+page.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export async function load({ params, parent }) {
- const stuff = await parent();
-
- return {
- survey: stuff.survey,
- sid: params.sid,
- };
-}
diff --git a/ui/src/routes/surveys/[sid]/live/+page.svelte b/ui/src/routes/surveys/[sid]/live/+page.svelte
deleted file mode 100644
index ddde42f..0000000
--- a/ui/src/routes/surveys/[sid]/live/+page.svelte
+++ /dev/null
@@ -1,302 +0,0 @@
-
-
-
-{#if $user && $user.is_admin}
-
-
-{/if}
-
-
- <
- {survey.title}
-
-
- {#if ws_up}Connecté{:else}Déconnecté{/if}
-
-
-
-
- {:else}
-
- La session est terminée. On se retrouve une prochaine fois…
-
- {/if}
-
diff --git a/ui/src/routes/surveys/[sid]/responses/+page.js b/ui/src/routes/surveys/[sid]/responses/+page.js
deleted file mode 100644
index 1016575..0000000
--- a/ui/src/routes/surveys/[sid]/responses/+page.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export async function load({ parent }) {
- const stuff = await parent();
-
- return {
- survey: stuff.survey,
- };
-}
diff --git a/ui/src/routes/surveys/[sid]/responses/+page.svelte b/ui/src/routes/surveys/[sid]/responses/+page.svelte
deleted file mode 100644
index c5ad888..0000000
--- a/ui/src/routes/surveys/[sid]/responses/+page.svelte
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
-{#if $user && $user.is_admin}
-
- goto(`surveys/${survey.id}/admin`)}
- />
-
-
- {#if exportview}
-
- {/if}
-{/if}
-
-
- <
- {survey.title}
- {#if exportview}Réponses{:else}Corrections{/if}
-
-
-
-
-{#if $user && $user.is_admin && edit}
- edit = false} />
-{/if}
-
-{#await getQuestions(survey.id)}
-
-
-
Chargement des questions …
-
-{:then questions}
- {#if !exportview}
-
-
-
-
- | Question |
- Réponses |
- Moyenne |
-
-
-
- {#each questions as question (question.id)}
-
- | {question.title} |
- {#await question.getResponses()}
-
-
- Chargement …
- |
- {:then responses}
-
- {#if responses}
- {responses.filter((r) => !r.time_scored || (r.time_reported && r.time_reported >= r.time_scored)).length} /
- {responses.length}
- {#await usersP then users}
-
- {Math.trunc(responses.length/users.length*1000)/10} %
- {/await}
- {:else}
- 0
- {/if}
- |
-
- {#if responses && responses.filter((r) => r.time_scored).length}
- {Math.trunc(responses.reduce((p, c) => (p + (c.score?c.score:0)), 0)/responses.filter((r) => r.time_scored).length*10)/10} %
- {:else}
- -- %
- {/if}
- |
- {/await}
-
- {/each}
-
-
-
- {:else}
- {#each questions as question (question.id)}
- {question.title}
- {#if question.kind == "text" || (exportview_list && question.kind.indexOf("list") == 0)}
- {#await question.getResponses() then responses}
- {#each responses as response (response.id)}
-
- {/each}
- {/await}
- {:else}
-
- {/if}
-
- {/each}
- {/if}
-{/await}
-
-
-
-
-
-
-
- Voici le lien de partage des résultats de ce sondage :
-
-
{sharing_link}
-
-
-
-
diff --git a/ui/src/routes/surveys/[sid]/responses/[rid].svelte b/ui/src/routes/surveys/[sid]/responses/[rid].svelte
new file mode 100644
index 0000000..727ddbc
--- /dev/null
+++ b/ui/src/routes/surveys/[sid]/responses/[rid].svelte
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+{#await surveyP then survey}
+ {#await getQuestion(rid)}
+
+
+
Chargement de la question…
+
+ {:then question}
+ {#await ctpls}
+
+
+
Chargement de la question…
+
+ {:then correctionTemplates}
+
+
+
+
+
+ <
+ {survey.title}
+ Corrections
+
+
+
+
+
+
+
+ {#if showResponses}
+
+ {/if}
+ {#if question.kind == "ucq" || question.kind == "mcq" || question.kind == "int"}
+
+ {/if}
+
+
+
+ {#if showResponses}
+
+ {/if}
+ {#if showChart}
+
+ {/if}
+
+
+ { nb_responses = v.detail; } }
+ />
+ {/await}
+ {/await}
+{/await}
+
+
diff --git a/ui/src/routes/surveys/[sid]/responses/[rid]/+page.js b/ui/src/routes/surveys/[sid]/responses/[rid]/+page.js
deleted file mode 100644
index a3387ab..0000000
--- a/ui/src/routes/surveys/[sid]/responses/[rid]/+page.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export async function load({ params, parent }) {
- const stuff = await parent();
-
- return {
- survey: stuff.survey,
- rid: params.rid,
- };
-}
diff --git a/ui/src/routes/surveys/[sid]/responses/[rid]/+page.svelte b/ui/src/routes/surveys/[sid]/responses/[rid]/+page.svelte
deleted file mode 100644
index 880f147..0000000
--- a/ui/src/routes/surveys/[sid]/responses/[rid]/+page.svelte
+++ /dev/null
@@ -1,173 +0,0 @@
-
-
-
-
-{#await getQuestion(data.rid)}
-
-
-
Chargement de la question…
-
-{:then question}
- {#await ctpls}
-
-
-
Chargement des templates…
-
- {:then correctionTemplates}
-
-
-
-
-
- <
- {survey.title}
- Corrections
-
-
-
-
-
-
-
- {#if showResponses}
-
- {/if}
- {#if question.kind == "ucq" || question.kind == "mcq" || question.kind == "int"}
-
- {/if}
-
-
-
- {#if showResponses}
-
- {/if}
- {#if showChart}
-
- {/if}
-
-
- { nb_responses = v.detail; } }
- />
- {/await}
-{/await}
-
-
diff --git a/ui/src/routes/surveys/[sid]/responses/index.svelte b/ui/src/routes/surveys/[sid]/responses/index.svelte
new file mode 100644
index 0000000..61a18bb
--- /dev/null
+++ b/ui/src/routes/surveys/[sid]/responses/index.svelte
@@ -0,0 +1,105 @@
+
+
+
+
+{#await surveyP then survey}
+ {#if $user && $user.is_admin}
+
+ goto(`surveys/${survey.id}/admin`)}
+ />
+ {/if}
+
+
+ <
+ {survey.title}
+ Corrections
+
+
+
+
+ {#if $user && $user.is_admin && edit}
+ edit = false} />
+ {/if}
+
+ {#await getQuestions(survey.id)}
+
+
+
Chargement des questions …
+
+ {:then questions}
+
+
+
+
+ | Question |
+ Réponses |
+ Moyenne |
+
+
+
+ {#each questions as question (question.id)}
+
+ | {question.title} |
+ {#await question.getResponses()}
+
+
+ Chargement …
+ |
+ {:then responses}
+
+ {#if responses}
+ {responses.filter((r) => !r.time_scored || (r.time_reported && r.time_reported >= r.time_scored)).length} /
+ {responses.length}
+ {#await usersP then users}
+
+ {Math.trunc(responses.length/users.length*1000)/10} %
+ {/await}
+ {:else}
+ 0
+ {/if}
+ |
+
+ {#if responses && responses.filter((r) => r.time_scored).length}
+ {Math.trunc(responses.reduce((p, c) => (p + (c.score?c.score:0)), 0)/responses.filter((r) => r.time_scored).length*10)/10} %
+ {:else}
+ -- %
+ {/if}
+ |
+ {/await}
+
+ {/each}
+
+
+
+ {/await}
+{/await}
diff --git a/ui/src/routes/surveys/+page.svelte b/ui/src/routes/surveys/index.svelte
similarity index 51%
rename from ui/src/routes/surveys/+page.svelte
rename to ui/src/routes/surveys/index.svelte
index 4d7ee2e..d83dbd4 100644
--- a/ui/src/routes/surveys/+page.svelte
+++ b/ui/src/routes/surveys/index.svelte
@@ -1,6 +1,6 @@
diff --git a/ui/src/routes/surveys/new/+page.svelte b/ui/src/routes/surveys/new.svelte
similarity index 66%
rename from ui/src/routes/surveys/new/+page.svelte
rename to ui/src/routes/surveys/new.svelte
index 9aaf369..2a4f626 100644
--- a/ui/src/routes/surveys/new/+page.svelte
+++ b/ui/src/routes/surveys/new.svelte
@@ -1,10 +1,10 @@
diff --git a/ui/src/routes/users/[uid]/+page.js b/ui/src/routes/users/[uid]/+page.js
deleted file mode 100644
index c735c6a..0000000
--- a/ui/src/routes/users/[uid]/+page.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export async function load({ params }) {
- return {
- uid: params.uid,
- };
-}
diff --git a/ui/src/routes/users/[uid]/+page.svelte b/ui/src/routes/users/[uid]/index.svelte
similarity index 89%
rename from ui/src/routes/users/[uid]/+page.svelte
rename to ui/src/routes/users/[uid]/index.svelte
index b607bed..f6fbaee 100644
--- a/ui/src/routes/users/[uid]/+page.svelte
+++ b/ui/src/routes/users/[uid]/index.svelte
@@ -1,17 +1,27 @@
-
- export let data;
+
-{#await getUser(data.uid)}
+
+
+{#await getUser(uid)}
Étudiant
@@ -18,7 +30,7 @@
Chargement des détails…
{:then student}
- {#await getSurvey(data.sid)}
+ {#await getSurvey(sid)}
Chargement du questionnaire …
@@ -38,7 +50,7 @@
Chargement des questions …
{:then questions}
-
+
{/await}
{:catch error}
diff --git a/ui/src/routes/users/[uid]/surveys/[sid]/+page.js b/ui/src/routes/users/[uid]/surveys/[sid]/+page.js
deleted file mode 100644
index b4f61ca..0000000
--- a/ui/src/routes/users/[uid]/surveys/[sid]/+page.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export async function load({ params }) {
- return {
- sid: params.sid,
- uid: params.uid,
- };
-}
diff --git a/ui/src/routes/users/[uid]/surveys/+page.svelte b/ui/src/routes/users/[uid]/surveys/index.svelte
similarity index 75%
rename from ui/src/routes/users/[uid]/surveys/+page.svelte
rename to ui/src/routes/users/[uid]/surveys/index.svelte
index d82f022..5d01356 100644
--- a/ui/src/routes/users/[uid]/surveys/+page.svelte
+++ b/ui/src/routes/users/[uid]/surveys/index.svelte
@@ -1,15 +1,25 @@
-
- export let data;
+
-{#await getUser(data.uid)}
+{#await getUser(uid)}
Étudiant
diff --git a/ui/src/routes/users/+page.svelte b/ui/src/routes/users/index.svelte
similarity index 74%
rename from ui/src/routes/users/+page.svelte
rename to ui/src/routes/users/index.svelte
index fd195a0..c20c526 100644
--- a/ui/src/routes/users/+page.svelte
+++ b/ui/src/routes/users/index.svelte
@@ -1,47 +1,30 @@
{#if $user && $user.is_admin}
-
OAuth GitLab
-
+
{#await getPromos() then promos}
-
+