fix: parser not saving unlimited attempts (#483)

* fix: default settings not loading for new problems

* fix: unlimited attempts not saving
This commit is contained in:
Kristin Aoki
2024-06-04 16:41:58 -04:00
committed by GitHub
parent a959c0543c
commit e543ccc2e1
10 changed files with 113 additions and 17 deletions

View File

@@ -6,7 +6,9 @@ export const popuplateItem = (parentObject, itemName, statekey, metadata, defaul
let parent = parentObject;
const item = _.get(metadata, itemName, null);
const equalsDefault = item === defaultValue;
if ((!_.isNil(item) || allowNull) && !equalsDefault) {
if (allowNull) {
parent = { ...parentObject, [statekey]: item };
} else if (!_.isNil(item) && !equalsDefault) {
parent = { ...parentObject, [statekey]: item };
}
return parent;