From 7e2c185c0328dc7855222ea19897d0b957264bd6 Mon Sep 17 00:00:00 2001
From: philipp <philipp@hofer.link>
Date: Thu, 16 May 2024 16:35:49 +0200
Subject: [PATCH] no rain level -> 0; round values

---
 src/scheduled/weather.rs    | 8 +-------
 templates/planned.html.tera | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/scheduled/weather.rs b/src/scheduled/weather.rs
index afabf65..113f8ab 100644
--- a/src/scheduled/weather.rs
+++ b/src/scheduled/weather.rs
@@ -19,13 +19,7 @@ pub async fn update(db: &SqlitePool, api_key: &str) -> Result<(), String> {
         };
         let max_temp = d.temp.max;
         let wind_gust = d.wind_gust;
-        let Some(rain_mm) = d.rain else {
-            println!(
-                "Skipping weather import of {} as there's no rain prognosed",
-                date
-            );
-            continue;
-        };
+        let rain_mm = d.rain.unwrap_or(0.);
 
         Weather::create(
             &mut tx,
diff --git a/templates/planned.html.tera b/templates/planned.html.tera
index 378e4a0..c7b1034 100644
--- a/templates/planned.html.tera
+++ b/templates/planned.html.tera
@@ -101,7 +101,7 @@
                     </h2>
                     {% if day.weather %}
                         <div class="bg-gray-300 rounded text-center">
-                            Max temp: {{ day.weather.max_temp }}° &bullet; Windböe: {{ day.weather.wind_gust }} km/h &bullet; Regen: {{ day.weather.rain_mm }} mm
+                            Max temp: {{ day.weather.max_temp | round }}° &bullet; Windböe: {{ day.weather.wind_gust | round }} km/h &bullet; Regen: {{ day.weather.rain_mm | round }} mm
                         </div>
                     {% endif %}
                     {% if day.planned_events | length > 0 or  day.trips | length > 0 %}