mirror of
https://github.com/jbowdre/lolz.git
synced 2024-11-12 17:32:19 +00:00
update some variable names
This commit is contained in:
parent
496afe149b
commit
96da02be2f
2 changed files with 9 additions and 9 deletions
2
.github/workflows/tempest.yml
vendored
2
.github/workflows/tempest.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
|||
- name: Fetch Tempest API data
|
||||
run: |
|
||||
curl --location "https://swd.weatherflow.com/swd/rest/better_forecast?station_id=${{ secrets.TEMPEST_STATION }}&token=${{ secrets.TEMPEST_TOKEN }}&units_temp=f&units_wind=mph&units_pressure=inhg&units_precip=in&units_distance=mi" \
|
||||
| jq '.current_conditions | {air_temperature: (.air_temperature | round), conditions, feels_like: (.feels_like | round), icon, precip_accum_local_day, pressure_trend, relative_humidity, station_pressure: ((.station_pressure * 100) | round | . / 100), time, wind_direction_cardinal, wind_gust}' \
|
||||
| jq '.current_conditions | {temperature: (.air_temperature | round), conditions, feels_like: (.feels_like | round), icon, rain_today: .precip_accum_local_day, pressure_trend, humidity: .relative_humidity, pressure: ((.sea_level_pressure * 100) | round | . / 100), time, wind_direction: .wind_direction_cardinal, wind_gust}' \
|
||||
> tempest.json
|
||||
- name: POST to paste.lol
|
||||
run: |
|
||||
|
|
16
tempest.html
16
tempest.html
|
@ -90,23 +90,23 @@
|
|||
|
||||
// parse data
|
||||
let conditions = (res.conditions).toLowerCase();
|
||||
let tempDiff = Math.abs(res.air_temperature - res.feels_like);
|
||||
let temp = `${res.air_temperature}°f (${(((res.air_temperature - 32) * 5) / 9).toFixed(1)}°c)`;
|
||||
let tempDiff = Math.abs(res.temperature - res.feels_like);
|
||||
let temp = `${res.temperature}°f (${(((res.temperature - 32) * 5) / 9).toFixed(1)}°c)`;
|
||||
if (tempDiff >= 5) {
|
||||
temp += `, feels ${res.feels_like}°f (${(((res.feels_like - 32) *5) / 9).toFixed(1)}°c)`;
|
||||
}
|
||||
let tempLabel = (tempRanges.find(range => res.feels_like < range.upper)).label;
|
||||
let humidity = `${res.relative_humidity}% humidity`;
|
||||
let wind = `${res.wind_gust}mph (${(res.wind_gust*1.609344).toFixed(1)}kph) from ${(res.wind_direction_cardinal).toLowerCase()}`;
|
||||
let precipLabel = (rainRanges.find(range => res.precip_accum_local_day < range.upper)).label;
|
||||
let humidity = `${res.humidity}% humidity`;
|
||||
let wind = `${res.wind_gust}mph (${(res.wind_gust*1.609344).toFixed(1)}kph) from ${(res.wind_direction).toLowerCase()}`;
|
||||
let precipLabel = (rainRanges.find(range => res.rain_today < range.upper)).label;
|
||||
let precipToday;
|
||||
if (res.precip_accum_local_day === 0) {
|
||||
if (res.rain_today === 0) {
|
||||
precipToday = 'no rain today';
|
||||
} else {
|
||||
precipToday = `${res.precip_accum_local_day}" rain today`;
|
||||
precipToday = `${res.rain_today}" rain today`;
|
||||
}
|
||||
let pressureTrend = res.pressure_trend;
|
||||
let pressure = `${res.station_pressure}inhg and ${pressureTrend}`;
|
||||
let pressure = `${res.pressure}inhg and ${pressureTrend}`;
|
||||
let icon = res.icon;
|
||||
|
||||
// display data
|
||||
|
|
Loading…
Reference in a new issue