1
0
forked from ScoDoc/ScoDoc

Assiduites: SignalAssiduiteDifferee bug fix

This commit is contained in:
Iziram 2023-11-17 13:50:49 +01:00
parent 4fe4dfe3e1
commit 295fb679ed
2 changed files with 22 additions and 13 deletions

View File

@ -191,8 +191,9 @@ function sync_get(path, success, errors) {
*/
async function async_get(path, success, errors) {
console.log("async_get " + path);
let response;
try {
const response = await fetch(path);
response = await fetch(path);
if (response.ok) {
const data = await response.json();
success(data);
@ -203,6 +204,8 @@ async function async_get(path, success, errors) {
console.error(error);
if (errors) errors(error);
}
return response;
}
/**
@ -233,8 +236,9 @@ function sync_post(path, data, success, errors) {
*/
async function async_post(path, data, success, errors) {
console.log("async_post " + path);
let response;
try {
const response = await fetch(path, {
response = await fetch(path, {
method: "POST",
headers: {
"Content-Type": "application/json",
@ -252,6 +256,8 @@ async function async_post(path, data, success, errors) {
console.error(error);
if (errors) errors(error);
}
return response;
}
// <<== Gestion des actions de masse ==>>

View File

@ -954,24 +954,27 @@
editList.push(edit);
})
$.when(
asyncCreateAssiduiteGroup(createList, (data) => {
const values = { "create": {}, "edit": {} };
Promise.all(
[asyncCreateAssiduiteGroup(createList, (data) => {
values.create = data;
}),
asyncEditAssiduiteGroup(editList, (data) => {
values.edit = data;
})
).done((c, e) => {
})]
).then(() => {
const c = values.create;
const e = values.edit;
let error;
Object.keys(c[0].success).forEach((k) => {
Object.keys(c.success).forEach((k) => {
const assiduite = createList[Number.parseInt(k)];
assiduite["assiduite_id"] = c[0].success[k].message.assiduite_id;
assiduite["assiduite_id"] = c.success[k].message.assiduite_id;
assiduites[assiduite.etudid].push(assiduite);
})
if (c[0].errors.length > 0) {
error = c[0].errors[Object.keys(c[0].errors)[0]];
if (c.errors.length > 0) {
error = c.errors[Object.keys(c.errors)[0]];
if (error.message.indexOf("Module") != -1) {
const html = `
<h3>Aucun module n'a été spécifié (préférence du semestre concerné)</h3>
@ -982,7 +985,7 @@
toCreate.length = 0
}
}
Object.keys(e[0].success).forEach((k) => {
Object.keys(e.success).forEach((k) => {
const { etudid, assiduite_id, moduleimpl_id, etat } = editList[Number.parseInt(k)]
assiduites[etudid].map((a) => {
if (a.assiduite_id == assiduite_id) {