Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Markopoulos committed Oct 25, 2024
1 parent 8743014 commit d531ada
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ const TemperatureChangeComponent = ({
classes,
}: TemperatureChangeProps) => {
const { satelliteTemperature } = data;

// Get the last 7 days of data - might not be recent
const lastWeekData = dailyData.slice(0, 7);
// Calculate the temperature change in the last 7 days - last day minus first day
const temperatureChange =
lastWeekData[0].satelliteTemperature - lastWeekData[6].satelliteTemperature;
// Calculate the average temperature of the last 7 days
const avgTemp =
lastWeekData.reduce((acc, curr) => acc + curr.satelliteTemperature, 0) / 7;

Expand Down

0 comments on commit d531ada

Please sign in to comment.