Fix bug with determining checklist progress
This commit is contained in:
parent
4da58241b3
commit
2f986bedf1
|
@ -25,20 +25,14 @@ export function createAdminStore() {
|
|||
`/api/global/configs/checklist?tenantId=${tenantId}`
|
||||
)
|
||||
const json = await response.json()
|
||||
|
||||
const onboardingSteps = Object.keys(json)
|
||||
|
||||
const stepsComplete = onboardingSteps.reduce(
|
||||
(score, step) => (score + step.checked ? 1 : 0),
|
||||
0
|
||||
)
|
||||
const totalSteps = Object.keys(json).length
|
||||
const completedSteps = Object.values(json).filter(x => x?.checked).length
|
||||
|
||||
await getFlags()
|
||||
admin.update(store => {
|
||||
store.loaded = true
|
||||
store.checklist = json
|
||||
store.onboardingProgress =
|
||||
(stepsComplete / onboardingSteps.length) * 100
|
||||
store.onboardingProgress = (completedSteps / totalSteps) * 100
|
||||
return store
|
||||
})
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue