Skip to content

Commit

Permalink
Showing recent electricity and water consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
srgtuszy committed Oct 28, 2024
1 parent 215fc82 commit 3ad8f6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dashboard/hotel-dashboard/components/hotel-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function HotelDashboard() {
number: roomData.roomNumber,
occupied: roomData.isOccupied,
lastName: roomData.lastName,
energy: Math.floor(electricityData[0]?.value || 0),
energy: Math.floor(electricityData[electricityData.length - 1]?.value || 0),
hourlyEnergy: electricityData.map((data) => Math.floor(data.value)),
water: 0,
hourlyWater: [],
Expand All @@ -92,7 +92,7 @@ export function HotelDashboard() {
if (roomIndex !== -1) {
const updatedRoom = {
...prevData[roomIndex],
water: Math.floor(waterData[0]?.value || 0),
water: Math.floor(waterData[waterData.length - 1]?.value || 0),
hourlyWater: waterData.map((data) => Math.floor(data.value)),
}
const newData = [...prevData]
Expand Down Expand Up @@ -209,7 +209,7 @@ export function HotelDashboard() {
</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<span>{room?.energy || 0} kWh</span>
<span>{room?.energy || 0} W</span>
<TinyLineChart data={room?.hourlyEnergy || []} color="chart-1" />
</div>
</TableCell>
Expand Down

0 comments on commit 3ad8f6c

Please sign in to comment.