Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Karakas
SWP_SS24_Wetterdaten_sammeln
Commits
fcb311bd
Commit
fcb311bd
authored
Jun 09, 2024
by
Weiser
Browse files
forecast if else
parent
2d6c61d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/weather/weatherForecastData.js
View file @
fcb311bd
...
...
@@ -193,22 +193,6 @@ const WeatherForecastData = (props) => {
id
=
"
hour_condition_text
"
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
"
/>
<
label
for
=
"
hour_wind
"
>
Hour
Wind
<
/label
>
<
br
/>
...
...
@@ -274,6 +258,18 @@ const WeatherForecastData = (props) => {
/>
<
label
for
=
"
hour_dewpoint
"
>
Hour
Dew
Point
<
/label
>
<
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
"
/>
<
label
for
=
"
hour_vis
"
>
Hour
Visibility
<
/label
>
<
br
/>
...
...
@@ -324,6 +320,9 @@ const WeatherForecastData = (props) => {
);
function
getData
()
{
const
units
=
document
.
getElementById
(
"
units
"
).
value
;
const
city
=
document
.
getElementById
(
"
city_text
"
).
value
;
const
region
=
document
.
getElementById
(
"
region_text
"
).
value
;
const
country
=
document
.
getElementById
(
"
country_text
"
).
value
;
...
...
@@ -396,6 +395,10 @@ const WeatherForecastData = (props) => {
const
hour_windchill
=
document
.
getElementById
(
"
hour_windchill
"
).
checked
;
const
hour_heatindex
=
document
.
getElementById
(
"
hour_heatindex
"
).
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_gust
=
document
.
getElementById
(
"
hour_gust
"
).
checked
;
const
hour_uv
=
document
.
getElementById
(
"
hour_uv
"
).
checked
;
...
...
@@ -414,12 +417,27 @@ const WeatherForecastData = (props) => {
if
(
last_updated
)
filterArray
.
push
(
"
last_updated
"
);
if
(
date
)
filterArray
.
push
(
"
date
"
);
if
(
date_epoch
)
filterArray
.
push
(
"
date_epoch
"
);
if
(
maxtemp
)
filterArray
.
push
(
"
maxtemp
"
);
if
(
mintemp
)
filterArray
.
push
(
"
mintemp
"
);
if
(
avgtemp
)
filterArray
.
push
(
"
avgtemp
"
);
if
(
maxwind
)
filterArray
.
push
(
"
maxwind
"
);
if
(
totalprecip
)
filterArray
.
push
(
"
totalprecip
"
);
if
(
avgvis
)
filterArray
.
push
(
"
avgvis
"
);
if
(
maxtemp
)
if
(
units
==
"
world
"
){
filterArray
.
push
(
"
maxtemp_c
"
);
}
else
{
filterArray
.
push
(
"
maxtemp_f
"
);}
if
(
mintemp
)
if
(
units
==
"
world
"
){
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
(
daily_will_it_rain
)
filterArray
.
push
(
"
daily_will_it_rain
"
);
if
(
daily_chance_of_rain
)
filterArray
.
push
(
"
daily_chance_of_rain
"
);
...
...
@@ -428,7 +446,7 @@ const WeatherForecastData = (props) => {
if
(
condition_text
)
filterArray
.
push
(
"
condition_text
"
);
if
(
condition_icon
)
filterArray
.
push
(
"
condition_icon
"
);
if
(
condition_code
)
filterArray
.
push
(
"
condition_code
"
);
if
(
uv
)
filterArray
.
push
(
"
uv
"
);
if
(
uv
)
filterArray
.
push
(
"
uv
_day
"
);
if
(
sunrise
)
filterArray
.
push
(
"
sunrise
"
);
if
(
sunset
)
filterArray
.
push
(
"
sunset
"
);
if
(
moonrise
)
filterArray
.
push
(
"
moonrise
"
);
...
...
@@ -437,24 +455,51 @@ const WeatherForecastData = (props) => {
if
(
moon_illumination
)
filterArray
.
push
(
"
moon_illumination
"
);
if
(
hour_time_epoch
)
filterArray
.
push
(
"
hourly_time_epoch
"
);
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_
condition_text
)
filterArray
.
push
(
"
hourly_condition_text
"
)
;
if
(
hour_condition_icon
)
filterArray
.
push
(
"
hourly_
condition_icon
"
);
if
(
hour_condition_code
)
filterArray
.
push
(
"
hourly_condition_code
"
);
if
(
hour_wind
)
filterArray
.
push
(
"
hourly_wind
"
);
if
(
hour_
wind
)
if
(
units
==
"
world
"
)
{
filterArray
.
push
(
"
hourly_
wind_kph
"
);
}
else
{
filterArray
.
push
(
"
hourly_wind
_mph
"
);
}
if
(
hour_wind_degree
)
filterArray
.
push
(
"
hourly_wind_degree
"
);
if
(
hour_wind_dir
)
filterArray
.
push
(
"
hourly_wind_dir
"
);
if
(
hour_pressure
)
filterArray
.
push
(
"
hourly_pressure
"
);
if
(
hour_precip
)
filterArray
.
push
(
"
hourly_precip
"
);
if
(
hour_pressure
)
if
(
units
==
"
world
"
){
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_cloud
)
filterArray
.
push
(
"
hourly_cloud
"
);
if
(
hour_feelslike
)
filterArray
.
push
(
"
hourly_feelslike
"
);
if
(
hour_windchill
)
filterArray
.
push
(
"
hourly_windchill
"
);
if
(
hour_heatindex
)
filterArray
.
push
(
"
hourly_heatindex
"
);
if
(
hour_dewpoint
)
filterArray
.
push
(
"
hourly_dewpoint
"
);
if
(
hour_vis
)
filterArray
.
push
(
"
hourly_vis
"
);
if
(
hour_gust
)
filterArray
.
push
(
"
hourly_gust
"
);
if
(
hour_feelslike
)
if
(
units
==
"
world
"
){
filterArray
.
push
(
"
hourly_feelslike_c
"
);
}
else
{
filterArray
.
push
(
"
hourly_feelslike_f
"
);}
if
(
hour_windchill
)
if
(
units
==
"
world
"
){
filterArray
.
push
(
"
hourly_windchill_c
"
);
}
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
"
);
let
filterString
=
filterArray
.
join
(
"
,
"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment