auto-git:
[change] renderer.js
This commit is contained in:
17
renderer.js
17
renderer.js
@@ -325,28 +325,33 @@ async function updateInteractionBar(folderObj) {
|
|||||||
const today = new Date().toISOString().slice(0, 10);
|
const today = new Date().toISOString().slice(0, 10);
|
||||||
const commitsToday = stats[today] || 0;
|
const commitsToday = stats[today] || 0;
|
||||||
|
|
||||||
// Globale Variablen (falls du sie irgendwo setzt)
|
// Globale Variablen aus Settings holen (am besten beim Start speichern)
|
||||||
const intelligentCommitThreshold = window.intelligentCommitThreshold || 50;
|
const intelligentCommitThreshold = await window.electronAPI.getIntelligentCommitThreshold?.() || 20;
|
||||||
const minutesCommitThreshold = window.minutesCommitThreshold || 20;
|
const minutesCommitThreshold = await window.electronAPI.getMinutesCommitThreshold?.() || 5;
|
||||||
|
|
||||||
// Lines until next Rewrite
|
// Lines until next Rewrite
|
||||||
const linesChanged = folderObj?.linesChanged || 0;
|
const linesChanged = folderObj?.linesChanged || 0;
|
||||||
const linesUntilRewrite = Math.max(0, intelligentCommitThreshold - linesChanged);
|
const linesUntilRewrite = Math.max(0, intelligentCommitThreshold - linesChanged);
|
||||||
|
|
||||||
// Time until next Rewrite
|
// Time until next Rewrite: *Initial berechnen, Live-Countdown separat*
|
||||||
let countdown = "00:00";
|
let countdown = "00:00";
|
||||||
|
let msLeft = 0;
|
||||||
if (folderObj?.firstCandidateBirthday) {
|
if (folderObj?.firstCandidateBirthday) {
|
||||||
const msThreshold = minutesCommitThreshold * 60 * 1000;
|
const msThreshold = minutesCommitThreshold * 60 * 1000;
|
||||||
const endTime = new Date(folderObj.firstCandidateBirthday).getTime() + msThreshold;
|
const endTime = new Date(folderObj.firstCandidateBirthday).getTime() + msThreshold;
|
||||||
const msLeft = Math.max(0, endTime - Date.now());
|
msLeft = Math.max(0, endTime - Date.now());
|
||||||
countdown = formatCountdown(msLeft);
|
countdown = formatCountdown(msLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Einsetzen in die Bar
|
// In die Bar schreiben
|
||||||
document.getElementById('commitsToday').textContent = commitsToday;
|
document.getElementById('commitsToday').textContent = commitsToday;
|
||||||
document.getElementById('linesUntilRewrite').textContent = linesUntilRewrite;
|
document.getElementById('linesUntilRewrite').textContent = linesUntilRewrite;
|
||||||
document.getElementById('countdown').textContent = countdown;
|
document.getElementById('countdown').textContent = countdown;
|
||||||
|
|
||||||
|
// Live-Countdown starten, aber nur wenn noch Zeit übrig
|
||||||
|
startLiveCountdown(folderObj, msLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startLiveCountdown(folderObj, msLeft) {
|
function startLiveCountdown(folderObj, msLeft) {
|
||||||
if (countdownInterval) clearInterval(countdownInterval);
|
if (countdownInterval) clearInterval(countdownInterval);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user