ResetCompletion()

This commit is contained in:
ReznoRMichael 2020-09-23 14:55:37 +02:00
parent a492f41a64
commit 7ac65f2d75

View file

@ -343,10 +343,6 @@ function HKCheckCompletion(jsonObject) {
// start benchmark // start benchmark
let countBegin = new Date(); let countBegin = new Date();
// Prevents wrong checkbox behaviour
CheckboxHintsToggle("hide");
CheckboxLocationsToggle("hide");
let HKPlayerData; let HKPlayerData;
let HKWorldItems; let HKWorldItems;
@ -363,6 +359,13 @@ function HKCheckCompletion(jsonObject) {
// Pre-Cleaning and filling initial data (h2, id) needed for FillHTML() // Pre-Cleaning and filling initial data (h2, id) needed for FillHTML()
PrefillHTML(DIV_ID); PrefillHTML(DIV_ID);
// Prevents adding current percent data after each function call (each click of Analyze button)
ResetCompletion(DIV_ID);
// Prevents wrong checkbox behaviour
CheckboxHintsToggle("hide");
CheckboxLocationsToggle("hide");
// Shallow Clone const objects (used for destructive functions) // Shallow Clone const objects (used for destructive functions)
let HK_HINTS_temp = Object.assign({}, HK_HINTS); let HK_HINTS_temp = Object.assign({}, HK_HINTS);
let HK_BOSSES_temp = Object.assign({}, HK_BOSSES); let HK_BOSSES_temp = Object.assign({}, HK_BOSSES);
@ -929,3 +932,14 @@ function CheckboxLocationsToggle(param) {
} }
} }
} }
/**
* Zero-fill all "percent" properties in the JSON Object (reset to default)
* @param {object} jsObj object containing the "percent" properties to be reset to 0
*/
function ResetCompletion(jsObj) {
for (let i in jsObj) {
if (jsObj[i].hasOwnProperty("percent")) jsObj[i].percent = 0;
}
}