You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1017 B
39 lines
1017 B
const BaseModel = {
|
|
buildResults(validResults, invalidResults, length) {
|
|
let valid;
|
|
const results = [];
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
valid = Math.random() < 0.5;
|
|
|
|
if (valid === true) {
|
|
results.push({
|
|
value: validResults[Math.floor(Math.random() * validResults.length)],
|
|
show: true,
|
|
valid: true
|
|
});
|
|
}
|
|
else {
|
|
results.push({
|
|
value: invalidResults[Math.floor(Math.random() * invalidResults.length)],
|
|
show: true,
|
|
valid: false
|
|
});
|
|
}
|
|
}
|
|
|
|
return results;
|
|
},
|
|
|
|
checkComplete(values, level) {
|
|
for (let i = 0; i < values.length; i++) {
|
|
if (values[i].valid === true && values[i].show === true) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
};
|
|
|
|
export default BaseModel;
|
|
|