diff --git a/app/utilities/defaults.js b/app/utilities/defaults.js
index ec0243c..1c31d2a 100644
--- a/app/utilities/defaults.js
+++ b/app/utilities/defaults.js
@@ -26,14 +26,14 @@ export const createDefaultLevelsObject = (numLevels) => {
const populatedLevels = {};
for (let i = 1; i <= numLevels; i++) {
- const levelId = "level" + i;
-
- populatedLevels[levelId] = {
- index: i,
+ populatedLevels[i] = {
+ level: i,
start: defaultValues.time,
end: defaultValues.time,
branches: createDefaultBranchesObject()
};
}
+
+ console.log(populatedLevels);
return populatedLevels;
}
\ No newline at end of file
diff --git a/app/utilities/exportHelperFunctions.js b/app/utilities/exportHelperFunctions.js
index 687a548..8369347 100644
--- a/app/utilities/exportHelperFunctions.js
+++ b/app/utilities/exportHelperFunctions.js
@@ -23,17 +23,32 @@ const traverseAndConvertToMilliseconds = (state, numFrames) => {
}
const trimStateAndCopy = (state) => {
- Object.keys(state.levels).map( function(levelId,_) {
+ let levels = state.levels;
- Object.keys(state.levels[levelId].branches).map( function(emotion,_) {
+ Object.keys(levels).map( function(levelId,_) {
+
+ Object.keys(levels[levelId].branches).map( function(emotion,_) {
- if (!state.levels[levelId].branches[emotion].enabled) {
- state.levels[levelId].branches[emotion] = undefined;
+ if (!levels[levelId].branches[emotion].enabled) {
+ levels[levelId].branches[emotion] = undefined;
} else {
- state.levels[levelId].branches[emotion].enabled = undefined;
+ levels[levelId].branches[emotion].enabled = undefined;
}
});
});
+
+
+ state.levels = arrayifyLevelsObject(levels);
+}
+
+const arrayifyLevelsObject = (levels) => {
+ let levelsArray = new Array(Object.keys(levels).length);
+
+ Object.keys(levels).map((levelIndex,_) => {
+ levelsArray[levelIndex-1] = levels[levelIndex];
+ });
+
+ return levelsArray;
}
export const convertToMillisecondsAndTrimState = (state, numFrames) => {