Amélioration de la gestion des projets et mise à jour des chemins d'images

This commit is contained in:
2025-02-11 20:43:59 +00:00
parent 3b694ff751
commit 6b9df1b0ee
3 changed files with 15 additions and 5 deletions

View File

@@ -5,10 +5,17 @@ document.addEventListener("DOMContentLoaded", async () => {
const data = await getAllProject();
const DataMetrics = await getDataMetrics(projectId);
document.getElementById("name_project").innerHTML = data[projectId].name;
console.log(projectId);
console.log(data);
const project = data.find(project => project.id == projectId);
if (project) {
document.getElementById("name_project").innerHTML = project.name;
} else {
console.error("Project not found");
}
const videoSelector = document.getElementById("video_selector");
const numberPicker = document.getElementById('number-picker');
const resultContainer = document.getElementById('result-container');
const choiceSelect = document.getElementById('choice');
const oneByOneContainer = document.getElementById('one-by-one-container');
const firstLastContainer = document.getElementById('first-last-container');
@@ -164,7 +171,7 @@ function populateImageTable(DataMetrics) {
let i = 0;
DataMetrics.forEach((measure) => {
let imageTD = document.createElement("td");
imageTD.innerHTML = `<img id="${i}" src="${api_url}/image/${measure.image_path}"/>`;
imageTD.innerHTML = `<img id="${i}" src="${api_url}/images/${measure.project_id}/${measure.order_id}"/>`;
row.appendChild(imageTD);
if ((i + 1) % 3 === 0 && i !== 0) {

View File

@@ -23,9 +23,8 @@ function getAllProject() {
return $.ajax({
url: api_url.concat("/projects"),
method: "GET",
dataType: "json",
dataType: "json"
}).then((data) => {
// If the request is successful, store the data in the cache and return it
return data;
});
}
@@ -38,6 +37,7 @@ function getDataMetrics(projectId){
}).then((data) => {
// If the request is successful, store the data in the cache and return it
localStorage.setItem("project_list", JSON.stringify(data));
console.log(data);
return data;
});
}