✨ (lean) add push strategy
This commit is contained in:
@@ -17,7 +17,9 @@ onMounted(() => featureStore.initBoard())
|
||||
{{ featureStore.meanLeadTime }} days
|
||||
</div>
|
||||
<div>
|
||||
<button @click="featureStore.nextDay()">next day</button>
|
||||
<button @click="featureStore.nextDay('push')">
|
||||
add feature and next day
|
||||
</button>
|
||||
Total days: {{ featureStore.meta.totalDays }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Feature } from '@/modules/feature/feature'
|
||||
import { FeatureStep } from '@/modules/feature/feature-steps'
|
||||
import { features } from '@/modules/feature/feature.fixture'
|
||||
import { Strategy } from '@/modules/lean/strategy'
|
||||
import { pickRandomElement, popNElement, shuffleArray } from '@/utils'
|
||||
|
||||
const MAX_FEATURES = 30
|
||||
@@ -73,11 +74,13 @@ export const initBoard = (
|
||||
export const nextDay = ({
|
||||
backlog,
|
||||
features,
|
||||
initialStep
|
||||
initialStep,
|
||||
strategy
|
||||
}: {
|
||||
backlog: Feature[]
|
||||
features: Feature[]
|
||||
initialStep: number
|
||||
strategy: Strategy
|
||||
}): Feature[] => {
|
||||
features.forEach((feature) => {
|
||||
const isFeatureLive = feature.step === 0 && feature.status === 'done'
|
||||
@@ -111,7 +114,7 @@ export const nextDay = ({
|
||||
}
|
||||
})
|
||||
|
||||
if (features.length < MAX_FEATURES) {
|
||||
if (strategy === 'push' && features.length < MAX_FEATURES) {
|
||||
const [newFeature] = popNElement(backlog, 1)
|
||||
|
||||
if (newFeature) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Feature } from '@/modules/feature/feature'
|
||||
import { initBoard, newBoard, nextDay } from '@/modules/feature/feature-board'
|
||||
import { FeatureStep, featureSteps } from '@/modules/feature/feature-steps'
|
||||
import { Strategy } from '@/modules/lean/strategy'
|
||||
import { sumElements } from '@/utils'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
@@ -29,11 +30,12 @@ export const useFeatureStore = defineStore('feature', {
|
||||
this.features = initBoard(this.steps, this.backlog)
|
||||
this.meta.totalDays = 0
|
||||
},
|
||||
nextDay() {
|
||||
nextDay(strategy: Strategy) {
|
||||
this.features = nextDay({
|
||||
backlog: this.backlog,
|
||||
features: this.features,
|
||||
initialStep: this.steps[0].stepIndex
|
||||
initialStep: this.steps[0].stepIndex,
|
||||
strategy
|
||||
})
|
||||
this.meta.totalDays++
|
||||
}
|
||||
|
||||
1
src/modules/lean/strategy.ts
Normal file
1
src/modules/lean/strategy.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type Strategy = 'push'
|
||||
Reference in New Issue
Block a user