diff --git a/py_app/app/__pycache__/routes.cpython-311.pyc b/py_app/app/__pycache__/routes.cpython-311.pyc index 4f6e790..2494f39 100644 Binary files a/py_app/app/__pycache__/routes.cpython-311.pyc and b/py_app/app/__pycache__/routes.cpython-311.pyc differ diff --git a/py_app/app/static/script.js b/py_app/app/static/script.js index 15d72c6..9fd30ac 100644 --- a/py_app/app/static/script.js +++ b/py_app/app/static/script.js @@ -238,40 +238,55 @@ document.addEventListener('DOMContentLoaded', () => { }); // Populate the table with data - function populateTable(data) { - const tableHead = reportTable.querySelector('thead tr'); - const tableBody = reportTable.querySelector('tbody'); +function populateTable(data) { + const tableHead = reportTable.querySelector('thead tr'); + const tableBody = reportTable.querySelector('tbody'); - // Clear existing table content - tableHead.innerHTML = ''; - tableBody.innerHTML = ''; + // Clear existing table content + tableHead.innerHTML = ''; + tableBody.innerHTML = ''; - if (data.headers && data.rows) { - // Populate table headers - data.headers.forEach((header) => { - const th = document.createElement('th'); - th.textContent = header; - tableHead.appendChild(th); - }); + if (data.headers && data.rows) { + // Populate table headers + data.headers.forEach((header) => { + const th = document.createElement('th'); + th.textContent = header; + tableHead.appendChild(th); + }); - // Populate table rows - data.rows.forEach((row) => { - const tr = document.createElement('tr'); - row.forEach((cell) => { - const td = document.createElement('td'); - td.textContent = cell; - tr.appendChild(td); - }); - tableBody.appendChild(tr); - }); - } else { - // No data available + // Populate table rows + data.rows.forEach((row) => { const tr = document.createElement('tr'); - const td = document.createElement('td'); - td.textContent = 'No data available.'; - td.colSpan = data.headers ? data.headers.length : 1; - tr.appendChild(td); + row.forEach((cell, index) => { + const td = document.createElement('td'); + + // Check if the header is "Date" and format the cell value + if (data.headers[index].toLowerCase() === 'date' && cell) { + const date = new Date(cell); + if (!isNaN(date)) { + // Format as yyyy-mm-dd + const formattedDate = date.toISOString().split('T')[0]; + td.textContent = formattedDate; + } else { + td.textContent = cell; // Fallback if not a valid date + } + } else { + td.textContent = cell; + } + + tr.appendChild(td); + }); tableBody.appendChild(tr); - } + }); + } else { + // No data available + const tr = document.createElement('tr'); + const td = document.createElement('td'); + td.textContent = 'No data available.'; + td.colSpan = data.headers ? data.headers.length : 1; + tr.appendChild(td); + tableBody.appendChild(tr); + } + } }); \ No newline at end of file diff --git a/py_app/app/templates/quality.html b/py_app/app/templates/quality.html index 5145061..2f20736 100644 --- a/py_app/app/templates/quality.html +++ b/py_app/app/templates/quality.html @@ -6,12 +6,12 @@

Rapoarte

- - + +
- - + +