Skip to content

Commit

Permalink
🐛 fix: meal plan generation not working for future weeks
Browse files Browse the repository at this point in the history
  • Loading branch information
MakakWasTaken committed Feb 7, 2024
1 parent fa95e76 commit 77e0790
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 46 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
"analyze": "cross-env ANALYZE=true next build",
"prepare": "husky install",
"typescript:check": "tsc --noEmit",
"translate": "ts-node --esm ./scripts/translate-site.mts"
"translate": "npx tsx ./scripts/translate-site.mts"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "biome format --write --no-errors-on-unmatched",
"*.{js,jsx,ts,tsx|json}": "biome lint --apply --no-errors-on-unmatched"
},
"dependencies": {
"@auth/prisma-adapter": "^1.3.2",
"@auth/prisma-adapter": "^1.3.3",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@gradio/client": "^0.10.1",
"@gradio/client": "^0.11.0",
"@mui/icons-material": "^5.15.8",
"@mui/material": "^5.15.8",
"@mui/material": "5.15.7",
"@mui/x-date-pickers": "^6.19.3",
"@next/bundle-analyzer": "^14.1.0",
"@prisma/client": "^5.9.1",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/da/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,14 @@
"rating": "Vurdering",
"message": "Anmeldelse",
"updating": "Opdaterer",
"updated": "Opdateret"
"updated": "Opdateret",
"followers": "Tilhængere",
"following": "Efter",
"joined_in": "Tilsluttede sig",
"change_meal": "Ændr måltid",
"change_meal_description": "Vælg en ny opskrift for at tilføje den til den aktuelle dag",
"search_for_recipe": "Søg efter opskrift",
"meal_plan": "Meal Plan",
"my_meal_plan": "Min madplan",
"meal": "Måltid"
}
3 changes: 2 additions & 1 deletion public/locales/da/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"settings": "Indstillinger",
"logout": "Log ud",
"get_started": "Kom Igang",
"create": "Opret"
"create": "Opret",
"meal_plan": "Meal Plan"
}
12 changes: 11 additions & 1 deletion public/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,15 @@
"rating": "Bewertung",
"message": "Nachricht",
"updating": "Aktualisierung",
"updated": "Aktualisiert"
"updated": "Aktualisiert",
"followers": "Folger************************************************************************************************************************************************************************************************************************************",
"following": "Nachstehend:",
"joined_in": "Verbunden mit",
"change_meal": "Mahlzeiten ändern",
"change_meal_description": "Wählen Sie ein neues Rezept, um es dem aktuellen Tag hinzuzufügen",
"search_for_recipe": "Nach Rezept suchen",
"meal_plan": "Meal Plan",
"my_meal_plan": "Mein Essensplan",
"week": "Woche",
"meal": "Mahlzeit"
}
3 changes: 2 additions & 1 deletion public/locales/de/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"logout": "Logout",
"get_started": "Get Started",
"home": "Home",
"about": "Über"
"about": "Über",
"meal_plan": "Meal Plan"
}
3 changes: 2 additions & 1 deletion public/locales/en/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"settings": "Settings",
"logout": "Logout",
"get_started": "Get Started",
"create": "Create"
"create": "Create",
"meal_plan": "Meal Plan"
}
13 changes: 12 additions & 1 deletion public/locales/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,16 @@
"rating": "Puntuación",
"message": "Mensaje",
"updating": "Actualizando",
"updated": "Actualizado"
"updated": "Actualizado",
"followers": "Seguidores",
"following": "A continuación",
"feed": "Fuente",
"joined_in": "Ingresó",
"change_meal": "Cambiar la comida",
"change_meal_description": "Seleccione una nueva receta para añadirla al día actual",
"search_for_recipe": "Buscar receta",
"meal_plan": "Meal Plan",
"my_meal_plan": "Mi plan de comidas",
"week": "Semana",
"meal": "Comida"
}
3 changes: 2 additions & 1 deletion public/locales/es/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"recipes": "Recetas",
"settings": "Configuración",
"logout": "Cerrar sesión",
"get_started": "Empezar"
"get_started": "Empezar",
"meal_plan": "Meal Plan"
}
4 changes: 1 addition & 3 deletions scripts/translate-site.mts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ const localizeTranslationFiles = async () => {
if (result.data.length > 0) {
translations[key] = result.data[0]
}
} catch (err) {
console.error(err)
}
} catch (err) {}
}

// Save the translations file
Expand Down
1 change: 0 additions & 1 deletion src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const Header: React.FC<React.PropsWithChildren<unknown>> = () => {
{
label: t('meal_plan'),
href: '/meal-plan',
authState: 'authenticated',
},
],
[t],
Expand Down
4 changes: 2 additions & 2 deletions src/utils/meaplanHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const updateMealplan = async (
(meal) =>
meal.recipeType === RecipeType.MAIN &&
meal.mealType === MealType.DINNER &&
DateTime.utc().hasSame(DateTime.fromJSDate(meal.date), 'week'),
startDate.hasSame(DateTime.fromJSDate(meal.date), 'week'),
),
}

Expand All @@ -167,7 +167,7 @@ export const updateMealplan = async (
(recipe) =>
recipe.mealType === MealType.DINNER &&
recipe.recipeType === RecipeType.MAIN &&
sameDate(DateTime.fromJSDate(recipe.date), currentDateTime),
DateTime.fromJSDate(recipe.date).hasSame(currentDateTime, 'day'),
)
})

Expand Down
79 changes: 50 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ __metadata:
version: 8
cacheKey: 10c0

"@auth/core@npm:0.26.2":
version: 0.26.2
resolution: "@auth/core@npm:0.26.2"
"@auth/core@npm:0.26.3":
version: 0.26.3
resolution: "@auth/core@npm:0.26.3"
dependencies:
"@panva/hkdf": "npm:^1.1.1"
"@types/cookie": "npm:0.6.0"
Expand All @@ -27,18 +27,18 @@ __metadata:
optional: true
nodemailer:
optional: true
checksum: 10c0/c87f9aa43c0cf5ec37aed2a1891139910d009b1911b4780f1cb1ca834a2e3c6a522949002aa6e67f621c7582aaf0f79418555fd92645e2d458f9cb8ebc5123bd
checksum: 10c0/a4cbbada93b72d75b57c0169bffe39680622e7d0c05eebeb11f28d40659b4a8959dcb04d8c1db538084601412a6cb49a85a6429d590e4cc667b4d96d38826924
languageName: node
linkType: hard

"@auth/prisma-adapter@npm:^1.3.2":
version: 1.3.2
resolution: "@auth/prisma-adapter@npm:1.3.2"
"@auth/prisma-adapter@npm:^1.3.3":
version: 1.3.3
resolution: "@auth/prisma-adapter@npm:1.3.3"
dependencies:
"@auth/core": "npm:0.26.2"
"@auth/core": "npm:0.26.3"
peerDependencies:
"@prisma/client": ">=2.26.0 || >=3 || >=4 || >=5"
checksum: 10c0/d71c8618537cd54a44699f10b64ece63300b97815b4f8226a8dcb482dc23f5ea71ee3ef462494f57ed1f7fe94b31d847682c30afd36d82e4db87177ab7fe1341
checksum: 10c0/b6522d86cd601abb8f42d69f3773473757e4cc9314f3a7ec8d06051e7ae3c45c9fd8e09eb4be2c11c39c71e7b95f09733881b2cc38fa515098e18b5352aaf17d
languageName: node
linkType: hard

Expand Down Expand Up @@ -668,14 +668,14 @@ __metadata:
languageName: node
linkType: hard

"@gradio/client@npm:^0.10.1":
version: 0.10.1
resolution: "@gradio/client@npm:0.10.1"
"@gradio/client@npm:^0.11.0":
version: 0.11.0
resolution: "@gradio/client@npm:0.11.0"
dependencies:
bufferutil: "npm:^4.0.7"
semiver: "npm:^1.1.0"
ws: "npm:^8.13.0"
checksum: 10c0/22c1ac80b4b1a9b8a5135ac6f44cf760249b52167324ad6230a1723525bfc54c7f179669e871f1e76be58782d772eaa640b77db3072770b4e6b10d6bb08b7862
checksum: 10c0/f50e8f5c18d7cd37293ff46e1933f2a933ab5e6ab9122dd97ebd4aad73a3678202cd219dd99235fcbf6d8a9f39cfc5de182405885ed4387f2b933fc382d83692
languageName: node
linkType: hard

Expand Down Expand Up @@ -911,7 +911,29 @@ __metadata:
languageName: node
linkType: hard

"@mui/base@npm:5.0.0-beta.35, @mui/base@npm:^5.0.0-beta.22":
"@mui/base@npm:5.0.0-beta.34":
version: 5.0.0-beta.34
resolution: "@mui/base@npm:5.0.0-beta.34"
dependencies:
"@babel/runtime": "npm:^7.23.9"
"@floating-ui/react-dom": "npm:^2.0.8"
"@mui/types": "npm:^7.2.13"
"@mui/utils": "npm:^5.15.7"
"@popperjs/core": "npm:^2.11.8"
clsx: "npm:^2.1.0"
prop-types: "npm:^15.8.1"
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 10c0/11140f6c49373714b3f3019931aa46542c986d33916e17636f6eeaae85ececb12e2cba58503a367ce0516a7b4e99a009988ca7ef85ae73c8aa05986cb9f56d11
languageName: node
linkType: hard

"@mui/base@npm:^5.0.0-beta.22":
version: 5.0.0-beta.35
resolution: "@mui/base@npm:5.0.0-beta.35"
dependencies:
Expand All @@ -933,7 +955,7 @@ __metadata:
languageName: node
linkType: hard

"@mui/core-downloads-tracker@npm:^5.15.8":
"@mui/core-downloads-tracker@npm:^5.15.7":
version: 5.15.8
resolution: "@mui/core-downloads-tracker@npm:5.15.8"
checksum: 10c0/41c73f8882c5b6460f5d0e1ddca90b43a9f2106686c68ee27dba60cb03c13f4954fd12d20512a9960ab9d892545ee910ad1b1a8c79212501a7cd662d3570fa1b
Expand All @@ -956,16 +978,16 @@ __metadata:
languageName: node
linkType: hard

"@mui/material@npm:^5.15.8":
version: 5.15.8
resolution: "@mui/material@npm:5.15.8"
"@mui/material@npm:5.15.7":
version: 5.15.7
resolution: "@mui/material@npm:5.15.7"
dependencies:
"@babel/runtime": "npm:^7.23.9"
"@mui/base": "npm:5.0.0-beta.35"
"@mui/core-downloads-tracker": "npm:^5.15.8"
"@mui/system": "npm:^5.15.8"
"@mui/base": "npm:5.0.0-beta.34"
"@mui/core-downloads-tracker": "npm:^5.15.7"
"@mui/system": "npm:^5.15.7"
"@mui/types": "npm:^7.2.13"
"@mui/utils": "npm:^5.15.8"
"@mui/utils": "npm:^5.15.7"
"@types/react-transition-group": "npm:^4.4.10"
clsx: "npm:^2.1.0"
csstype: "npm:^3.1.2"
Expand All @@ -975,7 +997,6 @@ __metadata:
peerDependencies:
"@emotion/react": ^11.5.0
"@emotion/styled": ^11.3.0
"@mui/zero-runtime": ^0.0.1
"@types/react": ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0
Expand All @@ -986,7 +1007,7 @@ __metadata:
optional: true
"@types/react":
optional: true
checksum: 10c0/34227586ba03bd8664aa9d9bff3c54ca23178eaa952073edd8b72c8c839260dfba0077862820e5f0e933f0d7a0674f69d96c0aa7322a6dca8ce0f5012c45d47e
checksum: 10c0/33634e7e6680424a6b2037aa4266aed5e67d297ff62d67fbf0a208a52e28bfe57dd7ca117ae09b891726effba56a527db35f6665b34ca0de854856c067c1f5cb
languageName: node
linkType: hard

Expand Down Expand Up @@ -1028,7 +1049,7 @@ __metadata:
languageName: node
linkType: hard

"@mui/system@npm:^5.15.8":
"@mui/system@npm:^5.15.7":
version: 5.15.8
resolution: "@mui/system@npm:5.15.8"
dependencies:
Expand Down Expand Up @@ -1068,7 +1089,7 @@ __metadata:
languageName: node
linkType: hard

"@mui/utils@npm:^5.14.16, @mui/utils@npm:^5.15.8":
"@mui/utils@npm:^5.14.16, @mui/utils@npm:^5.15.7, @mui/utils@npm:^5.15.8":
version: 5.15.8
resolution: "@mui/utils@npm:5.15.8"
dependencies:
Expand Down Expand Up @@ -7112,15 +7133,15 @@ __metadata:
version: 0.0.0-use.local
resolution: "yourkitchen-website@workspace:."
dependencies:
"@auth/prisma-adapter": "npm:^1.3.2"
"@auth/prisma-adapter": "npm:^1.3.3"
"@biomejs/biome": "npm:1.5.2"
"@commitlint/cli": "npm:^18.6.0"
"@commitlint/config-conventional": "npm:^18.6.0"
"@emotion/react": "npm:^11.11.3"
"@emotion/styled": "npm:^11.11.0"
"@gradio/client": "npm:^0.10.1"
"@gradio/client": "npm:^0.11.0"
"@mui/icons-material": "npm:^5.15.8"
"@mui/material": "npm:^5.15.8"
"@mui/material": "npm:5.15.7"
"@mui/x-date-pickers": "npm:^6.19.3"
"@next/bundle-analyzer": "npm:^14.1.0"
"@prisma/client": "npm:^5.9.1"
Expand Down

0 comments on commit 77e0790

Please sign in to comment.