[alfred] Update Forecast workflow
change
commit 179cbaacbee31fcfed15be3da51674f74ef6f0fa
author Alpha Chen <alpha.chen@gmail.com>
date
parent 570c726c
diff --git a/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.8694C3FC-8218-4B98-BB1F-F1CEC686477C/forecast.rb b/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.8694C3FC-8218-4B98-BB1F-F1CEC686477C/forecast.rb
index dd24d3e2..77d03c5f 100644
--- a/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.8694C3FC-8218-4B98-BB1F-F1CEC686477C/forecast.rb	
+++ b/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.8694C3FC-8218-4B98-BB1F-F1CEC686477C/forecast.rb	
@@ -78,11 +78,12 @@ items << Item.new(
 
 minutely = forecast['minutely']
 if minutely
-  intensity = minutely['data'].map {|m| 1000 * m['precipIntensity'] }
-  intensity = intensity.select.with_index {|_,i| i % 5 == 0 }
+  intensity = minutely['data'].map {|m| m['precipIntensity'] }
+  intensity = intensity.select.with_index {|_,i| i % 4 == 0 }
   min, max = intensity.minmax
+  intensity = intensity.map {|i| 1000 * i }
 
-  subtitle = ["#{min.round}\" #{Spark.new(intensity)} #{max.round}\""]
+  subtitle = ["#{min.round(3)}\" #{Spark.new(intensity)} #{max.round(3)}\""]
 
   probability = minutely['data'].map {|m| (100 * m['precipProbability']).round }
   probability = probability.select.with_index {|_,i| i % 5 == 0 }
@@ -100,11 +101,12 @@ end
 
 hourly = forecast['hourly']
 
-intensity = hourly['data'].map {|m| 1000 * m['precipIntensity'] }
+intensity = hourly['data'].map {|m| m['precipIntensity'] }
 intensity = intensity.select.with_index {|_,i| i % 4 == 0 }
 min, max = intensity.minmax
+intensity = intensity.map {|i| 1000 * i }
 
-subtitle = ["#{min.round}\" #{Spark.new(intensity)} #{max.round}\""]
+subtitle = ["#{min.round(3)}\" #{Spark.new(intensity)} #{max.round(3)}\""]
 
 probability = hourly['data'].map {|m| (100 * m['precipProbability']).round }
 probability = probability.select.with_index {|_,i| i % 4 == 0 }