Heatmap fix

This commit is contained in:
Yapollon 2024-03-07 15:04:29 +01:00
parent 56af47bda3
commit 82b36bcd0b
2 changed files with 7 additions and 8 deletions

View File

@ -71,7 +71,8 @@ class User(UserMixin):
for day in range(0, weekday):
heatmap.append(0)
for day in range (0, 28):
for day in range (0, 28-weekday):
value = get_heatmap_value(self.id, day)
heatmap.append(value)
heatmap.reverse()
return heatmap

View File

@ -3,7 +3,6 @@
function createHeatmap(data) {
const heatmapContainer = document.getElementById('heatmap');
// Aktuelles Datum des Montags
const days = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So']
for (let i = 0; i < 7; i++) {
@ -11,12 +10,11 @@ function createHeatmap(data) {
dayElement.classList.add('day');
dayElement.textContent = days[i];
heatmapContainer.appendChild(dayElement);
// currentDate.setDate(currentDate.getDate() + 1);
}
// Aktuelles Datum des Montags in der neuen linken Spalte
for (let i = 0; i < 7; i++) {
for (let j = 0; j < 4; j++) {
for (let i = 0; i < 4; i++) {
for (let j = 0; j < 7; j++) {
// console.log(i * 7 + j, data[i * 7 + j], Math.max(...data));
const opacity = data[i * 7 + j] / (Math.max(...data) <= 0 ? 1 : Math.max(...data)); // Berechne die Opazität basierend auf Aktivitätsanzahl
@ -126,9 +124,9 @@ function deleteList(listId) {
console.log(response.data);
// Remove the habit from the DOM
var habitElement = document.getElementById("simple-tabpanel-" + listId);
let habitElement = document.getElementById("simple-tabpanel-" + listId);
habitElement.remove();
var habitElement = document.getElementById("tab-" + listId);
habitElement = document.getElementById("tab-" + listId);
habitElement.remove();
}).catch(function (error) {
// Handle the error if needed
@ -137,7 +135,7 @@ function deleteList(listId) {
}
document.addEventListener('DOMContentLoaded', (event) => {
var elements = document.querySelectorAll('.task-list').values()
const elements = document.querySelectorAll('.task-list').values()
// loop through the elements
for (let el of elements) {