♻️ (flow) extract toInProgress method
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Feature } from '@/modules/feature/feature'
|
import { Feature, FeatureStatus } from '@/modules/feature/feature'
|
||||||
import { FeatureStep } from '@/modules/feature/feature-steps'
|
import { FeatureStep } from '@/modules/feature/feature-steps'
|
||||||
import { features as initialFeatures } from '@/modules/feature/feature.fixture'
|
import { features as initialFeatures } from '@/modules/feature/feature.fixture'
|
||||||
import { Strategy } from '@/modules/lean/strategy'
|
import { Strategy } from '@/modules/lean/strategy'
|
||||||
@@ -34,6 +34,39 @@ const getQualityIssue = ({
|
|||||||
return quality > qualityProbability / multiplicator
|
return quality > qualityProbability / multiplicator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mayBeInProgress = ({
|
||||||
|
features,
|
||||||
|
feature,
|
||||||
|
strategy,
|
||||||
|
steps
|
||||||
|
}: {
|
||||||
|
features: Feature[]
|
||||||
|
feature: Feature
|
||||||
|
steps: FeatureStep[]
|
||||||
|
strategy: Strategy
|
||||||
|
}): FeatureStatus => {
|
||||||
|
if (strategy !== 'pull') {
|
||||||
|
return 'doing'
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextStep = steps.find((step) => step.stepIndex === feature.step - 1)
|
||||||
|
|
||||||
|
if (!nextStep) {
|
||||||
|
return feature.status
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasBlueBinAvailableNextStep =
|
||||||
|
nextStep.blueBins -
|
||||||
|
features.filter((f) => f.step === feature.step - 1).length >
|
||||||
|
0
|
||||||
|
|
||||||
|
if (hasBlueBinAvailableNextStep) {
|
||||||
|
return 'doing'
|
||||||
|
}
|
||||||
|
|
||||||
|
return feature.status
|
||||||
|
}
|
||||||
|
|
||||||
export const newBacklog = (limit?: number) =>
|
export const newBacklog = (limit?: number) =>
|
||||||
limit !== undefined
|
limit !== undefined
|
||||||
? popNElement(shuffleArray(initialFeatures), limit)
|
? popNElement(shuffleArray(initialFeatures), limit)
|
||||||
@@ -84,26 +117,12 @@ export const getFeaturesForNextDay = ({
|
|||||||
feature.status = 'done'
|
feature.status = 'done'
|
||||||
break
|
break
|
||||||
case 'done':
|
case 'done':
|
||||||
if (strategy === 'pull') {
|
feature.status = mayBeInProgress({
|
||||||
const nextStep = steps.find(
|
features,
|
||||||
(step) => step.stepIndex === feature.step - 1
|
feature,
|
||||||
)
|
steps,
|
||||||
|
strategy
|
||||||
if (!nextStep) {
|
})
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasBlueBinAvailableNextStep =
|
|
||||||
nextStep.blueBins -
|
|
||||||
features.filter((f) => f.step === feature.step - 1).length >
|
|
||||||
0
|
|
||||||
|
|
||||||
if (hasBlueBinAvailableNextStep) {
|
|
||||||
feature.status = 'doing'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
feature.status = 'doing'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (feature.status === 'done') {
|
if (feature.status === 'done') {
|
||||||
break
|
break
|
||||||
@@ -120,6 +139,7 @@ export const getFeaturesForNextDay = ({
|
|||||||
if (hasQualityIssue) {
|
if (hasQualityIssue) {
|
||||||
feature.qualityIssue++
|
feature.qualityIssue++
|
||||||
} else {
|
} else {
|
||||||
|
// moving to the next team
|
||||||
feature.step--
|
feature.step--
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user