From 8123d6b0acec4bf25e3187218b818a9de1b5d892 Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Fri, 2 Jan 2026 10:19:57 +0100 Subject: [PATCH] feat: simulate a month --- src/AppHeijunka.vue | 19 ++++++++++++++++++- src/modules/heijkunka/heijunka-store.ts | 13 +++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/AppHeijunka.vue b/src/AppHeijunka.vue index 68635fa..abc3429 100644 --- a/src/AppHeijunka.vue +++ b/src/AppHeijunka.vue @@ -85,7 +85,21 @@ const createdAt = new Date('2026-01-01').toLocaleDateString(undefined, {

You know, from your years of experience, that in 3 days, you sell - approximately 5 shirts, 3 jeans, 2 pairs of shoes and 2 hats. + approximately +

+
+ +

Factory

diff --git a/src/modules/heijkunka/heijunka-store.ts b/src/modules/heijkunka/heijunka-store.ts index 553469f..7d3c1d6 100644 --- a/src/modules/heijkunka/heijunka-store.ts +++ b/src/modules/heijkunka/heijunka-store.ts @@ -37,8 +37,8 @@ const getInventoryByProduct = ( ): number => { const inventory = planning.filter( (p, index) => - index >= (currentDay - 1) * NUMBER_OF_HOURS_PER_DAY && - index < currentDay * NUMBER_OF_HOURS_PER_DAY && + index >= ((currentDay % NUMBER_OF_DAYS) - 1) * NUMBER_OF_HOURS_PER_DAY && + index < (currentDay % NUMBER_OF_DAYS) * NUMBER_OF_HOURS_PER_DAY && p === product ).length @@ -146,13 +146,18 @@ export const useHeijunkaStore = defineStore('heijunka', { this.planning = [] this.orders = [] this.inventory = { ...initialInventory } + }, + simulateMonth() { + for (let index = 0; index < 30; index++) { + this.newHour() + } } }, getters: { currentDay: (state) => Math.ceil(state.meta.currentHour / NUMBER_OF_HOURS_PER_DAY), - gameEnded: (state) => - state.meta.currentHour >= NUMBER_OF_DAYS * NUMBER_OF_HOURS_PER_DAY, + gameEnded: () => false, + // state.meta.currentHour >= NUMBER_OF_DAYS * NUMBER_OF_HOURS_PER_DAY, meanLeadTime: (state) => getMean(state.orders.map((o) => o.leadTime)) } })