Skip to content

Comments

Kfabb rtk-weather#22

Open
Kfabb wants to merge 3 commits intoprojectshft:mainfrom
Kfabb:main
Open

Kfabb rtk-weather#22
Kfabb wants to merge 3 commits intoprojectshft:mainfrom
Kfabb:main

Conversation

@Kfabb
Copy link

@Kfabb Kfabb commented Feb 23, 2025

No description provided.


const temperatureData = weatherData
? weatherData.list.map((item) => {
console.log(item)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not submit console logs

const temperatureData = weatherData
? weatherData.list.map((item) => {
console.log(item)
const celsius = item.main.temp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const celsius = item.main.temp
const rawTemperatureInCelsius = item.main.temp

? weatherData.list.map((item) => {
console.log(item)
const celsius = item.main.temp
const fahrenheit = (celsius * (9 / 5) + 32); // Convert Celsius to Fahrenheit

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export to a util function

Comment on lines +43 to +47
const pressureData = weatherData
? weatherData.list.map((item) => item.main.pressure)
: [];
const humidityData = weatherData
? weatherData.list.map((item) => item.main.humidity)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dry, you can use a function for this


let sum = 0;
let validCount = 0;
for (const point of data) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use forEach, safer than this


function WeatherChart({ data, title, units, color }) {
const average = calculateAverage(data)
console.log(average)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants