-
Notifications
You must be signed in to change notification settings - Fork 5
feat(TimedSteps): New type of step containing a series of timed components #2198
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! 👍 The functionality mostly seems to work as you described. I agree that the having the "proceed" button next to the timer makes it clearer for the user.
I noticed some minor issues (below) and code improvement suggestions (inline).
Issues, improvements
- See code improvement suggestions inline
- In preview, I finish the step and see the "You have completed this step” message. I then go to previous step and come back, and it lets me work on the first component again.
- Countdown glitch. Sometimes, due to some combination of letting the component timer finish and clicking on "proceed" for others, the timer seems to decrease erratically, like in 2-second decrements. See this video:
timer_glitch.mov
Questions
- Should we default to 60(?) seconds for each timed component in the authoring tool? We should require a non-null number for the timeLimit value to simplify code. Having a default can help ensure that.
- Right now, the timeLimit input is always shown for all components in the step in the. authoring tool. Should we only show it when the component is being edited? In this scenario, it would be good to show the time limit value for each component.
if (this.timedStep) { | ||
return !this.timedStepCompleted; | ||
} else { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write in one line?
@@ -43,14 +44,17 @@ export class StepToolsComponent implements OnInit { | |||
protected nodeStatus: any; | |||
protected nodeStatuses: any; | |||
protected prevId: string; | |||
@Input() private timedStep: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of making timedStep an input to this component, can we set this in updateModel()?
@Input() private timedStep: boolean; | |
private timedStep: boolean; |
@@ -26,7 +26,7 @@ | |||
|
|||
<ng-template #defaultVLETemplate> | |||
@if (layoutState === 'node') { | |||
<step-tools class="control-bg-bg mat-elevation-z1" /> | |||
<step-tools class="control-bg-bg mat-elevation-z1" [timedStep]="isCurrentNodeTimed()" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calculate timedStep boolean in StepToolsComponent.updateModel()? Remove isCurrentNodeTimed() function?
<step-tools class="control-bg-bg mat-elevation-z1" [timedStep]="isCurrentNodeTimed()" /> | |
<step-tools class="control-bg-bg mat-elevation-z1" /> |
const node = this.projectService.getNodeById(this.node.id); | ||
return node.timed !== null && node.timed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify?
const node = this.projectService.getNodeById(this.node.id); | |
return node.timed !== null && node.timed; | |
return this.projectService.getNodeById(this.node.id).timed; |
export class TimedNodeComponent extends NodeComponent { | ||
private componentTimers: number[]; | ||
private currentComponentIndex = 0; | ||
private currentInterval: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private currentInterval: any; | |
private currentInterval: number; |
return this.components.at(this.currentComponentIndex).id; | ||
} | ||
|
||
private getComponentSubmitArgs(componentId: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private getComponentSubmitArgs(componentId: string) { | |
private getComponentSubmitArgs(componentId: string): any { |
} | ||
} | ||
|
||
private saveUnsavedWork() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private saveUnsavedWork() { | |
private saveUnsavedWork(): void { |
} | ||
|
||
private saveUnsavedWork() { | ||
if (!this.isPreview()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check !isPreview() before calling this function?
this.components.forEach((component, index) => { | ||
this.componentToVisible[component.id] = index === this.currentComponentIndex; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this.hideComponents() here?
this.components.forEach((component, index) => { | |
this.componentToVisible[component.id] = index === this.currentComponentIndex; | |
}); | |
this.components.forEach((component, index) => { | |
this.componentToVisible[component.id] = index === this.currentComponentIndex; | |
}); |
} | ||
|
||
protected updateComponentVisibility(): void { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to have a comment about why we're overloading it with an empty body.
return; | |
// do nothing because ... |
Changes
Test
Other