From 73e67b805466f5a5e195306eec3eecfb87a5cffa Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sat, 12 Nov 2022 17:22:10 -0600 Subject: [PATCH] updates get-weather to remove the for loop (#313) --- weather/get-weather.nu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weather/get-weather.nu b/weather/get-weather.nu index 4b8de3d..8051578 100644 --- a/weather/get-weather.nu +++ b/weather/get-weather.nu @@ -70,10 +70,10 @@ def get_weather_by_ip [locIdx: int, units: string, token: string] { let url_forecast = $"($URL_FORECAST)?lat=($coords.lat.0)&lon=($coords.lon.0)&units=($units)&appid=($token)" let weather = (fetch $url) let forecast_data = (fetch $url_forecast) - let forecast = (for day in $forecast_data.list { + let forecast = ($forecast_data.list | each {|day| { id: ($day.weather.0.id) - dt: ($day.dt | into string | into datetime -z local | date format '%Y-%m-%d') + dt: ($day.dt | into string | into datetime -z local | date format '%a, %b %e') #'%Y-%m-%d') high: ($day.temp.max) low: ($day.temp.min) } @@ -111,7 +111,7 @@ def get_weather_by_ip [locIdx: int, units: string, token: string] { let forecast = (for day in $forecast_data.list { { id: ($day.weather.0.id) - dt: ($day.dt | into string | into datetime -z local | date format '%Y-%m-%d') + dt: ($day.dt | into string | into datetime -z local | date format '%a, %b %e') #'%Y-%m-%d') high: ($day.temp.max) low: ($day.temp.min) }