Skip to content

WIP - Feature/admin mode #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixes for progress recording
Signed-off-by: shmck <[email protected]>
  • Loading branch information
ShMcK committed Jul 27, 2020
commit 6759ce7a2a4576e1a92d27a6e641a4f9841d6407
17 changes: 10 additions & 7 deletions web-app/src/containers/Tutorial/formatLevels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,24 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output

const currentLevel = levels[levelIndex]

let stepIndex = currentLevel.steps.findIndex((s: TT.Step) => s.id === position.stepId)
if (stepIndex === -1) {
stepIndex = levels[levelIndex].steps.length
}

const levelUI: T.LevelUI = {
...currentLevel,
status: progress.levels[position.levelId] ? 'COMPLETE' : 'ACTIVE',
steps: currentLevel.steps.map((step: TT.Step) => {
steps: currentLevel.steps.map((step: TT.Step, index) => {
// label step status for step component
let status: T.ProgressStatus = 'INCOMPLETE'
let subtasks
if (progress.steps[step.id]) {
if (index < stepIndex || (index === stepIndex && progress.steps[step.id])) {
status = 'COMPLETE'
} else if (step.id === position.stepId) {
} else if (index === stepIndex) {
status = 'ACTIVE'
} else {
status = 'INCOMPLETE'
}
if (step.subtasks && step.subtasks) {
const testSummaries = Object.keys(testStatus?.summary || {})
Expand Down Expand Up @@ -95,10 +102,6 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output

const levelsUI: T.LevelUI[] = [...completed, levelUI, ...incompleted]

let stepIndex = levelUI.steps.findIndex((s: T.StepUI) => s.status === 'ACTIVE')
if (stepIndex === -1) {
stepIndex = levels[levelIndex].steps.length
}
return { level: levelUI, levels: levelsUI, levelIndex, stepIndex }
}

Expand Down