Commit fcb311bd authored by Weiser's avatar Weiser
Browse files

forecast if else

parent 2d6c61d2
...@@ -193,22 +193,6 @@ const WeatherForecastData = (props) => { ...@@ -193,22 +193,6 @@ const WeatherForecastData = (props) => {
id="hour_condition_text" id="hour_condition_text"
class="checkBoxFilter" class="checkBoxFilter"
/> />
<label for="hour_condition_text">Hour Condition Text</label>
<br />
<input
type="checkbox"
id="hour_condition_icon"
class="checkBoxFilter"
/>
<label for="hour_condition_icon">Hour Condition Icon</label>
<br />
<input
type="checkbox"
id="hour_condition_code"
class="checkBoxFilter"
/>
<label for="hour_condition_code">Hour Condition Code</label>
<br />
<input type="checkbox" id="hour_wind" class="checkBoxFilter" /> <input type="checkbox" id="hour_wind" class="checkBoxFilter" />
<label for="hour_wind">Hour Wind</label> <label for="hour_wind">Hour Wind</label>
<br /> <br />
...@@ -274,6 +258,18 @@ const WeatherForecastData = (props) => { ...@@ -274,6 +258,18 @@ const WeatherForecastData = (props) => {
/> />
<label for="hour_dewpoint">Hour Dew Point</label> <label for="hour_dewpoint">Hour Dew Point</label>
<br /> <br />
<input type="checkbox" id="hourly_will_it_rain" class="checkBoxFilter" />
<label for="hourly_will_it_rain">Will it Rain</label>
<br />
<input type="checkbox" id="hourly_chance_of_rain" class="checkBoxFilter" />
<label for="hourly_chance_of_rain">Chance of Rain</label>
<br />
<input type="checkbox" id="hourly_will_it_snow" class="checkBoxFilter" />
<label for="hourly_will_it_snow">Will it Snow</label>
<br />
<input type="checkbox" id="hourly_chance_of_snow" class="checkBoxFilter" />
<label for="hourly_chance_of_snow">Chance of Snow</label>
<br />
<input type="checkbox" id="hour_vis" class="checkBoxFilter" /> <input type="checkbox" id="hour_vis" class="checkBoxFilter" />
<label for="hour_vis">Hour Visibility</label> <label for="hour_vis">Hour Visibility</label>
<br /> <br />
...@@ -324,6 +320,9 @@ const WeatherForecastData = (props) => { ...@@ -324,6 +320,9 @@ const WeatherForecastData = (props) => {
); );
function getData() { function getData() {
const units = document.getElementById("units").value;
const city = document.getElementById("city_text").value; const city = document.getElementById("city_text").value;
const region = document.getElementById("region_text").value; const region = document.getElementById("region_text").value;
const country = document.getElementById("country_text").value; const country = document.getElementById("country_text").value;
...@@ -396,6 +395,10 @@ const WeatherForecastData = (props) => { ...@@ -396,6 +395,10 @@ const WeatherForecastData = (props) => {
const hour_windchill = document.getElementById("hour_windchill").checked; const hour_windchill = document.getElementById("hour_windchill").checked;
const hour_heatindex = document.getElementById("hour_heatindex").checked; const hour_heatindex = document.getElementById("hour_heatindex").checked;
const hour_dewpoint = document.getElementById("hour_dewpoint").checked; const hour_dewpoint = document.getElementById("hour_dewpoint").checked;
const hourly_will_it_rain = document.getElementById("hourly_will_it_rain").checked;
const hourly_chance_of_rain = document.getElementById("hourly_chance_of_rain").checked;
const hourly_will_it_snow = document.getElementById("hourly_will_it_snow").checked;
const hourly_chance_of_snow = document.getElementById("hourly_chance_of_snow").checked;
const hour_vis = document.getElementById("hour_vis").checked; const hour_vis = document.getElementById("hour_vis").checked;
const hour_gust = document.getElementById("hour_gust").checked; const hour_gust = document.getElementById("hour_gust").checked;
const hour_uv = document.getElementById("hour_uv").checked; const hour_uv = document.getElementById("hour_uv").checked;
...@@ -414,12 +417,27 @@ const WeatherForecastData = (props) => { ...@@ -414,12 +417,27 @@ const WeatherForecastData = (props) => {
if (last_updated) filterArray.push("last_updated"); if (last_updated) filterArray.push("last_updated");
if (date) filterArray.push("date"); if (date) filterArray.push("date");
if (date_epoch) filterArray.push("date_epoch"); if (date_epoch) filterArray.push("date_epoch");
if (maxtemp) filterArray.push("maxtemp"); if (maxtemp) if(units=="world"){
if (mintemp) filterArray.push("mintemp"); filterArray.push("maxtemp_c");
if (avgtemp) filterArray.push("avgtemp"); }else{
if (maxwind) filterArray.push("maxwind"); filterArray.push("maxtemp_f");}
if (totalprecip) filterArray.push("totalprecip"); if (mintemp) if(units=="world"){
if (avgvis) filterArray.push("avgvis"); filterArray.push("mintemp_c");
}else{filterArray.push("mintemp");}
if (avgtemp) if(units=="world"){
filterArray.push("avgtemp_c");
}else{filterArray.push("avgtemp_f");
}
if (maxwind) if(units=="world"){
filterArray.push("maxwind_kph");
}else{filterArray.push("maxwind_mph");}
if (totalprecip)if(units=="world"){
filterArray.push("totalprecip_mm");
}else{ filterArray.push("totalprecip_in");}
if (avgvis) if(units=="world"){
filterArray.push("avgis_km");
}else{
filterArray.push("avgvis_miles");}
if (avghumidity) filterArray.push("avghumidity"); if (avghumidity) filterArray.push("avghumidity");
if (daily_will_it_rain) filterArray.push("daily_will_it_rain"); if (daily_will_it_rain) filterArray.push("daily_will_it_rain");
if (daily_chance_of_rain) filterArray.push("daily_chance_of_rain"); if (daily_chance_of_rain) filterArray.push("daily_chance_of_rain");
...@@ -428,7 +446,7 @@ const WeatherForecastData = (props) => { ...@@ -428,7 +446,7 @@ const WeatherForecastData = (props) => {
if (condition_text) filterArray.push("condition_text"); if (condition_text) filterArray.push("condition_text");
if (condition_icon) filterArray.push("condition_icon"); if (condition_icon) filterArray.push("condition_icon");
if (condition_code) filterArray.push("condition_code"); if (condition_code) filterArray.push("condition_code");
if (uv) filterArray.push("uv"); if (uv) filterArray.push("uv_day");
if (sunrise) filterArray.push("sunrise"); if (sunrise) filterArray.push("sunrise");
if (sunset) filterArray.push("sunset"); if (sunset) filterArray.push("sunset");
if (moonrise) filterArray.push("moonrise"); if (moonrise) filterArray.push("moonrise");
...@@ -437,24 +455,51 @@ const WeatherForecastData = (props) => { ...@@ -437,24 +455,51 @@ const WeatherForecastData = (props) => {
if (moon_illumination) filterArray.push("moon_illumination"); if (moon_illumination) filterArray.push("moon_illumination");
if (hour_time_epoch) filterArray.push("hourly_time_epoch"); if (hour_time_epoch) filterArray.push("hourly_time_epoch");
if (hour_time) filterArray.push("hourly_time"); if (hour_time) filterArray.push("hourly_time");
if (hour_temp) filterArray.push("hourly_temp"); if (hour_temp) if(units=="world"){
filterArray.push("hourly_temp_c");
}else{
filterArray.push("hourly_temp_f");}
if (hour_is_day) filterArray.push("hourly_is_day"); if (hour_is_day) filterArray.push("hourly_is_day");
if (hour_condition_text) filterArray.push("hourly_condition_text"); if (hour_wind)if(units=="world"){
if (hour_condition_icon) filterArray.push("hourly_condition_icon"); filterArray.push("hourly_wind_kph");
if (hour_condition_code) filterArray.push("hourly_condition_code"); }else{
if (hour_wind) filterArray.push("hourly_wind"); filterArray.push("hourly_wind_mph");}
if (hour_wind_degree) filterArray.push("hourly_wind_degree"); if (hour_wind_degree) filterArray.push("hourly_wind_degree");
if (hour_wind_dir) filterArray.push("hourly_wind_dir"); if (hour_wind_dir) filterArray.push("hourly_wind_dir");
if (hour_pressure) filterArray.push("hourly_pressure"); if (hour_pressure) if(units=="world"){
if (hour_precip) filterArray.push("hourly_precip"); filterArray.push("hourly_pressure_mb");
}else{filterArray.push("hourly_pressure_in");}
if (hour_precip) if(units=="world"){
filterArray.push("hourly_precip_mm");
}else{
filterArray.push("hourly_precip_in");}
if (hour_humidity) filterArray.push("hourly_humidity"); if (hour_humidity) filterArray.push("hourly_humidity");
if (hour_cloud) filterArray.push("hourly_cloud"); if (hour_cloud) filterArray.push("hourly_cloud");
if (hour_feelslike) filterArray.push("hourly_feelslike"); if (hour_feelslike) if(units=="world"){
if (hour_windchill) filterArray.push("hourly_windchill"); filterArray.push("hourly_feelslike_c");
if (hour_heatindex) filterArray.push("hourly_heatindex"); }else{filterArray.push("hourly_feelslike_f");}
if (hour_dewpoint) filterArray.push("hourly_dewpoint"); if (hour_windchill) if(units=="world"){
if (hour_vis) filterArray.push("hourly_vis"); filterArray.push("hourly_windchill_c");
if (hour_gust) filterArray.push("hourly_gust"); }else{filterArray.push("hourly_windchill_f");}
if (hour_heatindex)if(units=="world"){
filterArray.push("hourly_heatindex_c");
}else{ filterArray.push("hourly_heatindex_f");}
if (hour_dewpoint) if(units=="world"){
filterArray.push("hourly_dewpoint_c");
}else{
filterArray.push("hourly_dewpoint_f");}
if (hourly_will_it_rain) filterArray.push("hourly_will_it_rain");
if (hourly_chance_of_rain) filterArray.push("hourly_chance_of_rain");
if (hourly_will_it_snow) filterArray.push("hourly_will_it_snow");
if (hourly_chance_of_snow) filterArray.push("hourly_chance_of_snow");
if (hour_vis) if(units=="world"){
filterArray.push("hourly_vis_km");
}else{
filterArray.push("hourly_vis_miles");}
if (hour_gust) if(units=="world"){
filterArray.push("hourly_gust_kph");
}else{
filterArray.push("hourly_gust_mph");}
if (hour_uv) filterArray.push("hourly_uv"); if (hour_uv) filterArray.push("hourly_uv");
let filterString = filterArray.join(","); let filterString = filterArray.join(",");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment