fix(athonet/epc): mode license - illegal division by zero (#2844)

This commit is contained in:
qgarnier 2021-06-03 09:04:15 +02:00 committed by GitHub
parent de5c9ec642
commit 2681fc0d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 15 deletions

View File

@ -307,23 +307,29 @@ sub manage_selection {
);
}
$self->{license}->{global}->{users}->{used} = $result->{users_connected};
$self->{license}->{global}->{users}->{total} = $result->{max_active_users};
$self->{license}->{global}->{users}->{free} = $result->{max_active_users} - $result->{users_connected};
$self->{license}->{global}->{users}->{prct_used} = $result->{users_connected} * 100 / $result->{max_active_users};
$self->{license}->{global}->{users}->{prct_free} = 100 - $self->{license}->{global}->{users}->{prct_used};
if ($result->{max_active_users} > 0) {
$self->{license}->{global}->{users}->{used} = $result->{users_connected};
$self->{license}->{global}->{users}->{total} = $result->{max_active_users};
$self->{license}->{global}->{users}->{free} = $result->{max_active_users} - $result->{users_connected};
$self->{license}->{global}->{users}->{prct_used} = $result->{users_connected} * 100 / $result->{max_active_users};
$self->{license}->{global}->{users}->{prct_free} = 100 - $self->{license}->{global}->{users}->{prct_used};
}
$self->{license}->{global}->{sessions}->{used} = $result->{active_connections};
$self->{license}->{global}->{sessions}->{total} = $result->{max_active_sessions};
$self->{license}->{global}->{sessions}->{free} = $result->{max_active_sessions} - $result->{active_connections};
$self->{license}->{global}->{sessions}->{prct_used} = $result->{active_connections} * 100 / $result->{max_active_sessions};
$self->{license}->{global}->{sessions}->{prct_free} = 100 - $self->{license}->{global}->{sessions}->{prct_used};
if ($result->{max_active_sessions} > 0) {
$self->{license}->{global}->{sessions}->{used} = $result->{active_connections};
$self->{license}->{global}->{sessions}->{total} = $result->{max_active_sessions};
$self->{license}->{global}->{sessions}->{free} = $result->{max_active_sessions} - $result->{active_connections};
$self->{license}->{global}->{sessions}->{prct_used} = $result->{active_connections} * 100 / $result->{max_active_sessions};
$self->{license}->{global}->{sessions}->{prct_free} = 100 - $self->{license}->{global}->{sessions}->{prct_used};
}
$self->{license}->{global}->{usim}->{used} = $result->{hss_provisioned_users};
$self->{license}->{global}->{usim}->{total} = $result->{max_provisioned_usim};
$self->{license}->{global}->{usim}->{free} = $result->{max_provisioned_usim} - $result->{hss_provisioned_users};
$self->{license}->{global}->{usim}->{prct_used} = $result->{hss_provisioned_users} * 100 / $result->{max_provisioned_usim};
$self->{license}->{global}->{usim}->{prct_free} = 100 - $self->{license}->{global}->{users}->{prct_used};
if ($result->{max_provisioned_usim} > 0) {
$self->{license}->{global}->{usim}->{used} = $result->{hss_provisioned_users};
$self->{license}->{global}->{usim}->{total} = $result->{max_provisioned_usim};
$self->{license}->{global}->{usim}->{free} = $result->{max_provisioned_usim} - $result->{hss_provisioned_users};
$self->{license}->{global}->{usim}->{prct_used} = $result->{hss_provisioned_users} * 100 / $result->{max_provisioned_usim};
$self->{license}->{global}->{usim}->{prct_free} = 100 - $self->{license}->{global}->{users}->{prct_used};
}
}
1;