From 3810eef1fa88c784bddf0b4d01c252fa83c95c40 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 11 Apr 2023 18:00:04 +0000 Subject: [PATCH] fix spelling Signed-off-by: Arthur Lu --- db.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db.js b/db.js index ac579bf..5935b11 100644 --- a/db.js +++ b/db.js @@ -25,10 +25,10 @@ function init () { function requestResources (user, resources) { let approved = true; Object.keys(resources).forEach((element) => { - if(!(element in db[user].avaliable)) { // if the resource does not exist in the user's entry, assume the user is not allowed to use it + if(!(element in db[user].available)) { // if the resource does not exist in the user's entry, assume the user is not allowed to use it approved = false; } - else if (db[user].avaliable[element] - resources[element] < 0) { + else if (db[user].available[element] - resources[element] < 0) { approved = false; } }); @@ -46,7 +46,7 @@ function allocateResources (user, resources) { Object.assign(newdb, db); Object.keys(resources).forEach((element) => { if(typeof(resources[element]) === "number" && isFinite(resources[element])) { - newdb[user].avaliable[element] -= resources[element]; + newdb[user].available[element] -= resources[element]; } else { return false; @@ -74,7 +74,7 @@ function releaseResources (user, resources) { Object.assign(newdb, db); Object.keys(resources).forEach((element) => { if(typeof(resources[element]) === "number" && isFinite(resources[element]) && resources[element]) { - newdb[user].avaliable[element] += resources[element]; + newdb[user].available[element] += resources[element]; } else { return false;