fix: init board

This commit is contained in:
Julien Calixte
2025-08-13 14:26:00 +02:00
parent 13bd1cb788
commit 813ffd6991
5 changed files with 7 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ import { Chart as ChartJS, registerables } from 'chart.js'
import { useBoardGameStore } from '@/modules/5s/board-game-store' import { useBoardGameStore } from '@/modules/5s/board-game-store'
import { toDuration, toSeconds } from '@/modules/5s/utils' import { toDuration, toSeconds } from '@/modules/5s/utils'
import { getNatural } from '@/utils' import { getNatural } from '@/utils'
import { _ } from '@faker-js/faker/dist/airline-D6ksJFwG'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { Bar } from 'vue-chartjs' import { Bar } from 'vue-chartjs'

View File

@@ -10,7 +10,7 @@ defineProps<{ alias: string }>()
const featureStore = useFeatureStore() const featureStore = useFeatureStore()
onMounted(() => featureStore.initBoard('mobile-app', NUMBER_OF_FEATURES)) onMounted(() => featureStore.initBoard(NUMBER_OF_FEATURES))
</script> </script>
<template> <template>

View File

@@ -13,7 +13,7 @@ const featureStore = useFeatureStore()
const confirmReset = () => { const confirmReset = () => {
if (confirm('Are you sure you want to reset the board?')) { if (confirm('Are you sure you want to reset the board?')) {
featureStore.initBoard('mobile-app', NUMBER_OF_FEATURES) featureStore.initBoard(NUMBER_OF_FEATURES)
} }
} }
</script> </script>

View File

@@ -72,6 +72,7 @@ const mayBeInProgress = ({
export const newBacklog = (limit?: number) => { export const newBacklog = (limit?: number) => {
const initialFeatures = [...mobileAppFeatures] const initialFeatures = [...mobileAppFeatures]
return limit !== undefined return limit !== undefined
? popNElement(shuffleArray(initialFeatures), limit) ? popNElement(shuffleArray(initialFeatures), limit)
: shuffleArray(initialFeatures) : shuffleArray(initialFeatures)
@@ -249,8 +250,8 @@ export const nextDay = (
strategy: Strategy | 'problem-solving' strategy: Strategy | 'problem-solving'
): FeatureState => { ): FeatureState => {
state.meta.totalDays++ state.meta.totalDays++
// // each day, the teams know how to better work together // each day, the teams know how to better work together
// state.meta.teamWorkExperience += 0.1 // state.meta.teamWorkExperience += 0.1 // Removed with a simplified version of pull system without the problem-solving strategy
if (strategy === 'problem-solving') { if (strategy === 'problem-solving') {
const hasTeamLearned = randomFloat(0, 1) > 0.25 const hasTeamLearned = randomFloat(0, 1) > 0.25
@@ -301,7 +302,7 @@ export const simulate = (
): FeatureState => { ): FeatureState => {
let i = 0 let i = 0
while (!isProjectFinished(state.features) && i++ < HARD_STOP) { while (i++ < HARD_STOP && !isProjectFinished(state.features)) {
if (strategy.includes('dps')) { if (strategy.includes('dps')) {
if (state.meta.totalDays % 5 === 0) { if (state.meta.totalDays % 5 === 0) {
state = nextDay(state, 'problem-solving') state = nextDay(state, 'problem-solving')

View File

@@ -37,6 +37,7 @@ export const useFeatureStore = defineStore('feature', {
async initBoard(limit?: number) { async initBoard(limit?: number) {
this.backlog = newBacklog(limit) this.backlog = newBacklog(limit)
this.steps = featureSteps this.steps = featureSteps
const initialSteps = featureSteps.filter( const initialSteps = featureSteps.filter(
(step) => step.title !== 'Release' && step.title !== 'Development' (step) => step.title !== 'Release' && step.title !== 'Development'
) )