From 24bdde576133056ffd83d161ac71f18d87a0eb67 Mon Sep 17 00:00:00 2001 From: kudukm Date: Fri, 9 Jan 2026 15:54:35 +0100 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20naprawienie=20"Failed=20to=20fetch"?= =?UTF-8?q?=20po=20zalogowaniu,=20usuni=C4=99cie=20nieu=C5=BCywanej=20zale?= =?UTF-8?q?=C5=BCno=C5=9Bci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/stores/progress.ts | 59 ----------------------- frontend/src/views/ConfigureHabitView.vue | 2 - frontend/src/views/LoginView.vue | 1 - 3 files changed, 62 deletions(-) delete mode 100644 frontend/src/stores/progress.ts diff --git a/frontend/src/stores/progress.ts b/frontend/src/stores/progress.ts deleted file mode 100644 index 93ab099..0000000 --- a/frontend/src/stores/progress.ts +++ /dev/null @@ -1,59 +0,0 @@ - -import { defineStore } from 'pinia' - -interface LogEntry { - date: string - abstinent: boolean -} - -/** - * Store postępów i finansów dla Addiction Tracker. - * - Szacuje dni abstynencji na podstawie dziennika. - * - Szacuje oszczędności: dni_abstynencji * avgCostPerDay. - * - Szacuje potencjalne "dni życia odzyskane" jako współczynnik * dni_abstynencji. - */ -export const useProgressStore = defineStore('progress', { - state: () => ({ - startDate: new Date().toISOString().slice(0, 10), // YYYY-MM-DD - avgCostPerDay: 25, // PLN — np. paczka papierosów dziennie - goalDays: 30, - // dziennik: każdy wpis: { date: 'YYYY-MM-DD', abstinent: boolean } - dailyLog: [ - // przykładowe: ostatnie dni - {date: '2025-11-23', abstinent: true}, - {date: '2025-11-24', abstinent: true}, - {date: '2025-11-25', abstinent: false}, - // ... - ] as LogEntry[], - lifeDaysPerAbstinenceDay: 0.3 // domyślny szacunek — można edytować w ustawieniach - }), - - getters: { - daysAbstinent(state): number { - return state.dailyLog.reduce((sum, d) => sum + (d.abstinent ? 1 : 0), 0) - }, - savings(state): number { - return this.daysAbstinent * state.avgCostPerDay - }, - lifeDaysRegained(state): number { - return this.daysAbstinent * state.lifeDaysPerAbstinenceDay - } - }, - - actions: { - logDay(date: string, abstinent: boolean) { - const entry = this.dailyLog.find(d => d.date === date) - if (entry) { - entry.abstinent = abstinent - } else { - this.dailyLog.push({date, abstinent}) - } - }, - setAvgCostPerDay(pln: number) { - this.avgCostPerDay = Math.max(0, Number(pln) || 0) - }, - setLifeDaysPerAbstinenceDay(value: number) { - this.lifeDaysPerAbstinenceDay = Math.max(0, Number(value) || 0) - } - } -}) diff --git a/frontend/src/views/ConfigureHabitView.vue b/frontend/src/views/ConfigureHabitView.vue index 323326e..f4d204f 100644 --- a/frontend/src/views/ConfigureHabitView.vue +++ b/frontend/src/views/ConfigureHabitView.vue @@ -52,7 +52,6 @@