Fix wrong files for newly created ProductGamesystems
Some checks failed
E2E Testing / test (push) Failing after 1m41s

This commit is contained in:
Sebastian Böckelmann 2024-03-22 07:43:52 +01:00
parent c184c667fd
commit 50963387f0
4 changed files with 7 additions and 2 deletions

View File

@ -44,8 +44,7 @@ class GamesystemStorage {
return unreferencedFiles;
}
findReferencedGamesystem(referencedName, gamesystems) {
const searchedGamesystem = gamesystems.find(gamesystem => path.basename(gamesystem.fileName) === referencedName);
return searchedGamesystem;
return gamesystems.find(gamesystem => path.basename(gamesystem.fileName) === referencedName);
}
storeGamesystem(gamesystem) {
const gamesystemFile = path.join(...gamesystem.fileName.split("/"));

View File

@ -52,6 +52,7 @@ export class GameModel {
const parentProductGamesystem = ProductGamesystem.constructFromSimpleGamesystem(parentGamesystem, this);
parentProductGamesystem.addChildGamesystem(simpleGamesystem);
simpleGamesystem.parentGamesystem = parentProductGamesystem;
console.log("The parent of my parent is ", parentProductGamesystem.parentGamesystem!.componentName)
} else {
const productParentGamesystem = parentGamesystem as ProductGamesystem;
productParentGamesystem.addChildGamesystem(simpleGamesystem);

View File

@ -20,12 +20,14 @@ export class ProductGamesystem extends Gamesystem<ProductState, ProductTransitio
if(simpleGamesystem.states.length > 0) {
simpleGamesystem.componentName += "(Child)";
productGamesystem.addChildGamesystem(simpleGamesystem);
simpleGamesystem.parentGamesystem = productGamesystem
}
if(parentGamesystem != undefined) {
parentGamesystem.removeChildGamesystem(simpleGamesystem);
parentGamesystem.addChildGamesystem(productGamesystem);
productGamesystem.parentGamesystem = parentGamesystem
} else {
gameModel.removeGamesystem(simpleGamesystem);
gameModel.addGamesystem(productGamesystem);

View File

@ -26,6 +26,9 @@ export class GamesystemSerializer {
private static serializeSimpleGamesystem(simpleGamesystem: SimpleGamesystem): StoreComponent {
const fileName = this.computeSimpleGamesystemPath(simpleGamesystem);
if(simpleGamesystem.componentName === "Weather(Child)") {
console.log(fileName)
}
const jsonString = JSON.stringify(simpleGamesystem, (key, value) => {
if(this.IGNORED_SIMPLE_ATTRIBUTES.includes(key)) {