fix remove old data

This commit is contained in:
Marko Oldenburg 2022-12-20 13:24:15 +01:00
parent ca343e104b
commit b2d84725f7

View File

@ -422,6 +422,15 @@ sub _ProcessingRetrieveData {
given ( $self->{endpoint} ) { given ( $self->{endpoint} ) {
when ('onecall') { when ('onecall') {
## löschen des alten current Datensatzes
delete $self->{cached}->{current};
## löschen des alten forecast Datensatzes
delete $self->{cached}->{forecast};
## löschen des alten Alerts Datensatzes
delete $self->{cached}->{alerts};
$self->{cached}->{current} = { $self->{cached}->{current} = {
'temperature' => int( 'temperature' => int(
sprintf( "%.0f", $data->{current}->{temp} ) sprintf( "%.0f", $data->{current}->{temp} )
@ -495,9 +504,6 @@ sub _ProcessingRetrieveData {
if ( ref( $data->{hourly} ) eq "ARRAY" if ( ref( $data->{hourly} ) eq "ARRAY"
&& scalar( @{ $data->{hourly} } ) > 0 ) && scalar( @{ $data->{hourly} } ) > 0 )
{ {
## löschen des alten Datensatzes
delete $self->{cached}->{forecast};
my $i = 0; my $i = 0;
for ( @{ $data->{hourly} } ) { for ( @{ $data->{hourly} } ) {
push( push(
@ -788,9 +794,6 @@ sub _ProcessingRetrieveData {
if ( ref( $data->{alerts} ) eq "ARRAY" if ( ref( $data->{alerts} ) eq "ARRAY"
&& scalar( @{ $data->{alerts} } ) > 0 ) && scalar( @{ $data->{alerts} } ) > 0 )
{ {
## löschen des alten Datensatzes
delete $self->{cached}->{alerts};
my $i = 0; my $i = 0;
for ( @{ $data->{alerts} } ) { for ( @{ $data->{alerts} } ) {
push( push(