This commit is contained in:
Christopher Cookman 2024-12-16 20:35:15 -07:00
parent f775bf96da
commit 6f3ff88eae

View file

@ -34,13 +34,13 @@ $("#signin").on("click", function () {
}); });
// Pull analytics from /api/analytics // Pull analytics from /api/analytics
var lastText = "";
setInterval(() => { setInterval(() => {
fetch('/api/analytics') fetch('/api/analytics')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
estCallsMadeStat = data.total.find(stat => stat.tag === "estCallsMade")?.count; estCallsMadeStat = data.total.find(stat => stat.tag === "estCallsMade")?.count;
currentDailyCallsMadeStat = data.daily.find(stat => stat.tag === "dailyCallsMade" && stat.current === true)?.count; currentDailyCallsMadeStat = data.daily.find(stat => stat.tag === "dailyCallsMade" && stat.current === true)?.count;
var lastText = "";
var newText = `Total calls made: ${estCallsMadeStat}<br>Today's calls made: ${currentDailyCallsMadeStat}`; var newText = `Total calls made: ${estCallsMadeStat}<br>Today's calls made: ${currentDailyCallsMadeStat}`;
if (lastText !== newText) { if (lastText !== newText) {
chgtext(newText); chgtext(newText);