Skip to content

Commit

Permalink
more automation for new children
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Nov 9, 2023
1 parent b16adf3 commit ac1840b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/features/children/children.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export class ChildrenController {
}
// for local purposes - organized folders and files
const newChildFolder = `../../Docs/children${
SexEnum.MALE ? '/boys/' : '/girls/'
body.sex === SexEnum.MALE ? '/boys/' : '/girls/'
}organized/${capitalizeFirstLetter(body.sayNameEn)}-${body.sayNameFa}`;

const originalAwakeGirl = `../../Docs/children/girls/${
Expand All @@ -335,8 +335,6 @@ export class ChildrenController {
const newAwakeName = `awake-${body.sayNameEn.toLowerCase()}.png`;
const newSleepName = `sleep-${body.sayNameEn.toLowerCase()}.png`;

console.log(originalAwakeBoy);

if (
checkIfFileOrDirectoryExists(originalAwakeGirl) ||
checkIfFileOrDirectoryExists(originalAwakeBoy)
Expand All @@ -349,11 +347,8 @@ export class ChildrenController {
moveFile(originalSleptBoy, `${newChildFolder}/${newSleepName}`);
}
if (Number(body.sex) === SexEnum.FEMALE) {
moveFile(originalSleptGirl, `${newChildFolder}/${newAwakeName}`);
moveFile(
originalSleptGirl,
`${newChildFolder}/sleep-${body.sayNameFa}.png`,
);
moveFile(originalAwakeGirl, `${newChildFolder}/${newAwakeName}`);
moveFile(originalSleptGirl, `${newChildFolder}/${newSleepName}`);
}
} else {
throw new ServerError('could not find the file');
Expand Down

0 comments on commit ac1840b

Please sign in to comment.