File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/main/java/nambang_swag/bada_on/entity Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,6 @@ public void updateWeatherData(String category, String value) {
123123 case "PCP" , "RN1" -> hourlyPrecipitation = parseAccumulation (value , "강수없음" );
124124 case "REH" -> humidity = parseInt (value );
125125 case "SNO" -> hourlySnowAccumulation = parseAccumulation (value , "적설없음" );
126-
127126 }
128127 } catch (NumberFormatException e ) {
129128 throw new IllegalArgumentException ("Failed to parse value: " + value + " for category: " + category , e );
@@ -142,12 +141,19 @@ private float parseAccumulation(String value, String noneString) {
142141 if (value .equals (noneString )) {
143142 return NO_DATA ;
144143 }
144+ return parseFloat (value .split ("mm" )[0 ]);
145+ }
146+
147+ private float parseHourlySnowAccumulation (String value , String noneString ) {
148+ if (value .equals (noneString )) {
149+ return NO_DATA ;
150+ }
145151
146152 if (value .endsWith ("cm미만" )) {
147153 String numericPart = value .substring (0 , value .indexOf ("cm" ));
148- return Float .parseFloat (numericPart ) / 10 ; // Convert cm to mm
154+ return Float .parseFloat (numericPart ); // Convert cm to mm
149155 }
150156
151- return parseFloat (value .split ("mm " )[0 ]);
157+ return parseFloat (value .split ("cm " )[0 ]);
152158 }
153159}
You can’t perform that action at this time.
0 commit comments