[feature] interactive deplete soon

Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
MHSanaei
2023-05-17 02:01:56 +03:30
parent be50be75fe
commit 2d16eabc6e
5 changed files with 28 additions and 26 deletions

View File

@@ -91,6 +91,21 @@ function setCookie(cname, cvalue, exdays) {
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
}
function usageColor(data, threshold, total) {
switch (true) {
case data === null:
return 'blue';
case total <= 0:
return 'blue';
case data < total - threshold:
return 'cyan';
case data < total:
return 'orange';
default:
return 'red';
}
}
function doAllItemsExist(array1, array2) {
for (let i = 0; i < array1.length; i++) {
if (!array2.includes(array1[i])) {
@@ -98,4 +113,4 @@ function doAllItemsExist(array1, array2) {
}
}
return true;
}
}