Fix real-time step count update
This commit is contained in:
1 parent
968d55131d
commit
80c0796113
1 file changed
+2
-7
+2
-7
@@ -1569,14 +1569,9 @@ window.logManualSteps = async function() {
|
|||||||
const val = parseInt(document.getElementById('manual-step-input').value.replace(/\D/g,''));
|
const val = parseInt(document.getElementById('manual-step-input').value.replace(/\D/g,''));
|
||||||
if (!val || val < 1) { showToast('Enter a valid step count', 'error'); return; }
|
if (!val || val < 1) { showToast('Enter a valid step count', 'error'); return; }
|
||||||
const today = todayKey();
|
const today = todayKey();
|
||||||
const steps = { ...(currentUserData.stepsByDate || {}) };
|
await updateDoc(doc(db, 'users', currentUser.uid), { [`stepsByDate.${today}`]: val });
|
||||||
steps[today] = val;
|
await updateDoc(doc(db, 'profiles', currentUser.uid), { [`stepsByDate.${today}`]: val });
|
||||||
await updateDoc(doc(db, 'users', currentUser.uid), { stepsByDate: steps });
|
|
||||||
await updateDoc(doc(db, 'profiles', currentUser.uid), { stepsByDate: steps });
|
|
||||||
currentUserData.stepsByDate = steps;
|
|
||||||
document.getElementById('manual-step-input').value = '';
|
document.getElementById('manual-step-input').value = '';
|
||||||
renderMySteps();
|
|
||||||
checkSetupReminder();
|
|
||||||
showToast('Steps logged ✓', 'success');
|
showToast('Steps logged ✓', 'success');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user