From 0463f6ffaa697ba7455e68b6a5deccadb2143583 Mon Sep 17 00:00:00 2001 From: JoshBaneyCS Date: Wed, 23 Apr 2025 08:32:02 +0000 Subject: [PATCH] Update server.js --- server.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server.js b/server.js index 4dc0435..30b1515 100644 --- a/server.js +++ b/server.js @@ -109,8 +109,8 @@ app.use(express.static(path.join(__dirname, 'public'))); app.post('/api/readings', async (req, res) => { try { const { inbound, outbound } = req.body; - const hiIn = computeHeatIndex(inbound.temperature, inbound.humidity); - const hiOut = computeHeatIndex(outbound.temperature, outbound.humidity); + const hiIn = computeHeatIndex(inbound_temperature, inbound_humidity); + const hiOut = computeHeatIndex(outbound_temperature, outbound_humidity); // Shift & period logic const { shift, shiftStart, key, estNow } = getShiftInfo(new Date()); @@ -123,13 +123,13 @@ app.post('/api/readings', async (req, res) => { (dockDoor, timestamp, temperature, humidity, heatIndex) VALUES (?, NOW(), ?, ?, ?) `; - await pool.execute(insertSQL, [inbound.dockDoor, inbound.temperature, inbound.humidity, hiIn]); - await pool.execute(insertSQL, [outbound.dockDoor, outbound.temperature, outbound.humidity, hiOut]); + await pool.execute(insertSQL, [inbound_dockDoor, inbound_temperature, inbound_humidity, hiIn]); + await pool.execute(insertSQL, [outbound_dockDoor, outbound_temperature, outbound_humidity, hiOut]); // Broadcast to SSE clients (use UTC ISO for front‐end) const isoNow = new Date().toISOString(); - broadcast('new-reading', { dockDoor: inbound.dockDoor, timestamp: isoNow, ...inbound, heatIndex: hiIn }); - broadcast('new-reading', { dockDoor: outbound.dockDoor, timestamp: isoNow, ...outbound, heatIndex: hiOut }); + broadcast('new-reading', { dockDoor: inbound_dockDoor, timestamp: isoNow, ...inbound, heatIndex: hiIn }); + broadcast('new-reading', { dockDoor: outbound_dockDoor, timestamp: isoNow, ...outbound, heatIndex: hiOut }); // Format EST timestamp for Slack const estString = estNow.toLocaleString('en-US', { @@ -143,14 +143,14 @@ app.post('/api/readings', async (req, res) => { let slackText = `${shift} Shift ${period} temperature checks for ${estString} EST -Inbound Dock Door: ${inbound.dockDoor} -Temp: ${inbound.temperature}°F -Humidity: ${inbound.humidity}% +Inbound Dock Door: ${inbound_dockDoor} +Temp: ${inbound_temperature}°F +Humidity: ${inbound_humidity}% Heat Index: ${hiIn} -Outbound Dock Door: ${outbound.dockDoor} -Temp: ${outbound.temperature}°F -Humidity: ${outbound.humidity}% +Outbound Dock Door: ${outbound_dockDoor} +Temp: ${outbound_temperature}°F +Humidity: ${outbound_humidity}% Heat Index: ${hiOut}`; // Upload today's CSV and append URL