diff --git a/ui/package-lock.json b/ui/package-lock.json
index 2c160ee..3ce834a 100644
--- a/ui/package-lock.json
+++ b/ui/package-lock.json
@@ -8,7 +8,6 @@
"name": "atsebayt",
"version": "0.0.1",
"dependencies": {
- "dayjs": "^1.11.5",
"svelte-frappe-charts": "^1.9.1",
"vite": "^3.0.4"
},
@@ -646,11 +645,6 @@
"node": ">= 8"
}
},
- "node_modules/dayjs": {
- "version": "1.11.5",
- "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz",
- "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA=="
- },
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -3097,11 +3091,6 @@
"which": "^2.0.1"
}
},
- "dayjs": {
- "version": "1.11.5",
- "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz",
- "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA=="
- },
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
diff --git a/ui/package.json b/ui/package.json
index dc0668f..76e67f4 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -28,7 +28,6 @@
},
"type": "module",
"dependencies": {
- "dayjs": "^1.11.5",
"svelte-frappe-charts": "^1.9.1",
"vite": "^3.0.4"
}
diff --git a/ui/src/components/DateTimeInput.svelte b/ui/src/components/DateTimeInput.svelte
deleted file mode 100644
index d39ff70..0000000
--- a/ui/src/components/DateTimeInput.svelte
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
diff --git a/ui/src/components/SubmissionStatus.svelte b/ui/src/components/SubmissionStatus.svelte
index b7ad14a..5a2b1d4 100644
--- a/ui/src/components/SubmissionStatus.svelte
+++ b/ui/src/components/SubmissionStatus.svelte
@@ -1,6 +1,4 @@
{#if work.submission_url == '-'}
{:else if work.submission_url}
- {#await renduP}
+ {#await getUserRendu(work.submission_url, user)}
{:then rendu}
{#if rendu === null}
@@ -46,7 +24,7 @@
{/await}
{:else}
- {#await submissionP}
+ {#await work.getSubmission(user.id)}
{:then submission}
diff --git a/ui/src/components/SurveyAdmin.svelte b/ui/src/components/SurveyAdmin.svelte
index 865e6a3..07b1455 100644
--- a/ui/src/components/SurveyAdmin.svelte
+++ b/ui/src/components/SurveyAdmin.svelte
@@ -3,7 +3,6 @@
import { goto } from '$app/navigation';
import { getQuestions } from '../lib/questions';
- import DateTimeInput from './DateTimeInput.svelte';
import { ToastsStore } from '../stores/toasts';
const dispatch = createEventDispatcher();
@@ -14,21 +13,17 @@
dispatch('saved', response);
}, (error) => {
ToastsStore.addErrorToast({
- msg: error,
+ msg: error.errmsg,
});
})
}
- let deleteInProgress = false;
function deleteSurvey() {
- deleteInProgress = true;
survey.delete().then((response) => {
- deleteInProgress = false;
goto(`surveys`);
}, (error) => {
- deleteInProgress = false;
ToastsStore.addErrorToast({
- msg: error,
+ msg: error.errmsg,
});
})
}
@@ -38,7 +33,7 @@
goto(`surveys/${response.id}`);
}).catch((error) => {
ToastsStore.addErrorToast({
- msg: error,
+ msg: error.errmsg,
});
})
}
@@ -109,7 +104,7 @@
-
+
@@ -118,7 +113,7 @@
-
+
@@ -142,12 +137,7 @@
{#if survey.id}
-
+
{/if}
diff --git a/ui/src/components/WorkAdmin.svelte b/ui/src/components/WorkAdmin.svelte
index 8660e1d..b9e7c55 100644
--- a/ui/src/components/WorkAdmin.svelte
+++ b/ui/src/components/WorkAdmin.svelte
@@ -2,7 +2,6 @@
import { createEventDispatcher } from 'svelte';
import { goto } from '$app/navigation';
- import DateTimeInput from './DateTimeInput.svelte';
import { ToastsStore } from '../stores/toasts';
const dispatch = createEventDispatcher();
@@ -13,7 +12,7 @@
dispatch('saved', response);
}, (error) => {
ToastsStore.addErrorToast({
- msg: error,
+ msg: error.errmsg,
});
})
}
@@ -23,7 +22,7 @@
goto(`works`);
}, (error) => {
ToastsStore.addErrorToast({
- msg: error,
+ msg: error.errmsg,
});
})
}
@@ -33,7 +32,7 @@
goto(`works/${response.id}`);
}).catch((error) => {
ToastsStore.addErrorToast({
- msg: error,
+ msg: error.errmsg,
});
})
}
@@ -103,7 +102,7 @@
-
+
@@ -112,7 +111,7 @@
-
+
diff --git a/ui/src/lib/questions.js b/ui/src/lib/questions.js
index 53e2115..bb81ab0 100644
--- a/ui/src/lib/questions.js
+++ b/ui/src/lib/questions.js
@@ -120,12 +120,6 @@ export class Question {
async delete() {
if (this.id) {
- // Start by deleting proposals
- const proposals = await this.getProposals();
- for (const p of proposals) {
- await p.delete();
- }
-
const res = await fetch(`api/questions/${this.id}`, {
method: 'DELETE',
headers: {'Accept': 'application/json'},
diff --git a/ui/src/lib/surveys.js b/ui/src/lib/surveys.js
index 9e1e69f..b3904d3 100644
--- a/ui/src/lib/surveys.js
+++ b/ui/src/lib/surveys.js
@@ -1,4 +1,3 @@
-import { getCorrectionTemplates } from './correctionTemplates';
import { getQuestions } from './questions';
import { Response } from './response';
import { Work } from './works';
@@ -102,33 +101,9 @@ export class Survey {
// Now recopy questions
const questions = await getQuestions(oldSurveyId);
for (const q of questions) {
- const oldQuestionId = q.id;
-
delete q.id;
q.id_survey = response.id;
- q.save().then((question) => {
- q.id = oldQuestionId;
-
- // 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
- getCorrectionTemplates(oldQuestionId).then((cts) => {
- for (const ct of cts) {
- delete ct.id;
- ct.id_question = question.id;
- ct.save();
- }
- });
- });
+ q.save();
}
return response;
@@ -140,12 +115,6 @@ export class Survey {
async delete() {
if (this.id) {
- // Start by deleting questions
- const questions = await getQuestions(this.id);
- for (const q of questions) {
- await q.delete();
- }
-
const res = await fetch(`api/surveys/${this.id}`, {
method: 'DELETE',
headers: {'Accept': 'application/json'},
diff --git a/ui/src/routes/surveys/[sid]/responses/index.svelte b/ui/src/routes/surveys/[sid]/responses/index.svelte
index 6414f38..f90105f 100644
--- a/ui/src/routes/surveys/[sid]/responses/index.svelte
+++ b/ui/src/routes/surveys/[sid]/responses/index.svelte
@@ -13,26 +13,20 @@
{#await surveyP then survey}
- {#if $user && $user.is_admin}
-
- goto(`surveys/${survey.id}/admin`)}
- />
- {/if}
+ goto(`surveys/${survey.id}/admin`)}
+ />
- {#if $user && $user.is_admin && edit}
- edit = false} />
- {/if}
-
{#await getQuestions(survey.id)}
diff --git a/ui/src/routes/works/[wid]/rendus.svelte b/ui/src/routes/works/[wid]/rendus.svelte
index 55ebb28..2511e44 100644
--- a/ui/src/routes/works/[wid]/rendus.svelte
+++ b/ui/src/routes/works/[wid]/rendus.svelte
@@ -22,14 +22,6 @@
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;
{#await work then w}
@@ -37,12 +29,12 @@
<
{w.title}
- Rendus {Math.trunc(nb_rendus/nb_users*100)} % ({nb_rendus}/{nb_users})
- {#await usersP then users}
+ {#await getUsers(w.promo, w.group)}
+ {:then users}
@@ -56,7 +48,7 @@
{user.login} |
- { nb_rendus += 1; user.show_dl_btn = true; }} />
+
|
{#await getRepositories(w.id, user.id) then repos}
@@ -90,7 +82,6 @@
|