Skip to content

Commit 299487f

Browse files
authored
Merge pull request #2503 from codecrafters-io/revert-2496-stage-1-experiments
Revert "Experiment: Stage 1 - Hide Test Runner Card Before User Has Submitted Again"
2 parents 2cbbe24 + 59fb768 commit 299487f

File tree

7 files changed

+29
-90
lines changed

7 files changed

+29
-90
lines changed

app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs

+14-37
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,22 @@
2121
@isComplete={{this.uncommentCodeStepIsComplete}}
2222
/>
2323
{{else if (eq stepList.expandedStep.id "submit-code")}}
24-
<CoursePage::CourseStageStep::FirstStageTutorialCard::SubmitCodeStep
25-
@isComplete={{this.submitCodeStepIsComplete}}
26-
@shouldHideTestRunnerCardRelatedCopy={{@shouldHideTestRunnerCardRelatedCopy}}
27-
/>
24+
<CoursePage::CourseStageStep::FirstStageTutorialCard::SubmitCodeStep @isComplete={{this.submitCodeStepIsComplete}} />
2825
{{/if}}
2926
</ExpandableStepList>
3027

31-
{{#if @shouldHideTestRunnerCardRelatedCopy}}
32-
{{#if this.shouldShowLinkToForum}}
33-
<div class="prose dark:prose-invert prose-sm prose-compact mt-6">
34-
<p>Need help?</p>
35-
<ul>
36-
<li>
37-
<a
38-
href="https://forum.codecrafters.io/new-topic?category=Challenges&tags=challenge%3A{{this.currentCourse.slug}}&title=%5B{{this.currentCourse.shortName}}%5D%20How%20to%20pass%20the%20first%20stage%3F&body=Checklist%3A%0A%0A1.%20%E2%9C%85%20or%20%E2%9D%8C%3A%20I%27ve%20uncommented%20the%20code.%0A2.%20%E2%9C%85%20or%20%E2%9D%8C%3A%20I%27ve%20saved%20the%20changes.%0A3.%20%E2%9C%85%20or%20%E2%9D%8C%3A%20I%27ve%20run%20the%20git%20commands%3A%0A%0A%60%60%60%0Agit%20commit%20-am%20%22%5Bseeking%20help%20on%20forum%5D%22%0Agit%20push%20origin%20master%0A%60%60%60%0A%0A---%0A%0AHere%E2%80%99s%20a%20screenshot%20showing%20the%20output%20from%20running%20the%20Git%20commands%3A%0A%0A%5BAttach%20screenshot%20here%5D%0A%0A%5BShare%20other%20details%20here%5D"
39-
target="_blank"
40-
rel="noopener noreferrer"
41-
>
42-
Post your issue</a>
43-
on the forum — Andy usually replies within 6 hours.
44-
</li>
45-
</ul>
46-
</div>
47-
{{/if}}
48-
{{else}}
49-
{{! After step 2, step 3 already contains a note on Tests Failed, so we can hide this !}}
50-
{{#unless this.uncommentCodeStepIsComplete}}
51-
<div class="prose dark:prose-invert prose-sm prose-compact mt-5">
52-
<p>
53-
{{svg-jar "information-circle" class="w-5 h-5 mb-1 inline-flex text-sky-500"}}
54-
<b>Note:</b>
55-
After your first Git push, you should see
56-
<code
57-
class="font-semibold text-red-700 dark:text-red-300 bg-red-100 dark:bg-red-900/30 border border-red-200 dark:border-red-800/40"
58-
>Tests failed</code>
59-
in the bar below this card. This is expected! Complete the steps above to pass the tests.
60-
</p>
61-
</div>
62-
{{/unless}}
63-
{{/if}}
28+
{{! After step 2, step 3 already contains a note on Tests Failed, so we can hide this !}}
29+
{{#unless this.uncommentCodeStepIsComplete}}
30+
<div class="prose dark:prose-invert prose-sm prose-compact mt-5">
31+
<p>
32+
{{svg-jar "information-circle" class="w-5 h-5 mb-1 inline-flex text-sky-500"}}
33+
<b>Note:</b>
34+
After your first Git push, you should see
35+
<code class="font-semibold text-red-700 dark:text-red-300 bg-red-100 dark:bg-red-900/30 border border-red-200 dark:border-red-800/40">Tests
36+
failed</code>
37+
in the bar below this card. This is expected! Complete the steps above to pass the tests.
38+
</p>
39+
</div>
40+
{{/unless}}
6441
</:content>
6542
</CoursePage::InstructionsCard>

app/components/course-page/course-stage-step/first-stage-tutorial-card.ts

-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import CoursePageStateService from 'codecrafters-frontend/services/course-page-s
44
import FeatureFlagsService from 'codecrafters-frontend/services/feature-flags';
55
import Store from '@ember-data/store';
66
import type CourseStageModel from 'codecrafters-frontend/models/course-stage';
7-
import type CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step';
87
import type RepositoryModel from 'codecrafters-frontend/models/repository';
98
import type { Step } from 'codecrafters-frontend/components/expandable-step-list';
109
import { action } from '@ember/object';
@@ -15,8 +14,6 @@ interface Signature {
1514
Args: {
1615
repository: RepositoryModel;
1716
courseStage: CourseStageModel;
18-
currentStep: CourseStageStep;
19-
shouldHideTestRunnerCardRelatedCopy: boolean;
2017
};
2118
}
2219

@@ -73,10 +70,6 @@ export default class FirstStageTutorialCardComponent extends Component<Signature
7370
@service declare featureFlags: FeatureFlagsService;
7471
@service declare store: Store;
7572

76-
get currentCourse() {
77-
return this.args.courseStage.course;
78-
}
79-
8073
get navigateToFileStepIsComplete() {
8174
return this.navigateToFileStepWasMarkedAsComplete || this.uncommentCodeStepIsComplete;
8275
}
@@ -85,12 +78,6 @@ export default class FirstStageTutorialCardComponent extends Component<Signature
8578
return this.coursePageState.manuallyCompletedStepIdsInFirstStageInstructions.includes('navigate-to-file');
8679
}
8780

88-
get shouldShowLinkToForum() {
89-
const currentStep = this.args.currentStep;
90-
91-
return currentStep.testsStatus !== 'passed' && currentStep.status !== 'complete';
92-
}
93-
9481
get steps() {
9582
return [
9683
new NavigateToFileStep(this.args.repository, this.navigateToFileStepIsComplete),

app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.hbs

+10-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
<div class="prose dark:prose-invert">
1010
<p class={{if @isComplete "line-through"}}>
11-
Once you run the commands above, our system will automatically test your code.
11+
Once you run the commands above, the
12+
<code class="font-semibold text-red-700 bg-red-100 border border-red-200">Tests failed</code>
13+
message below this card will change to
14+
<code class="font-semibold text-green-700 bg-green-100 border border-green-200">Tests passed</code>.
1215
</p>
1316

1417
{{#if @isComplete}}
@@ -20,12 +23,10 @@
2023
</div>
2124

2225
{{#unless @isComplete}}
23-
{{#unless @shouldHideTestRunnerCardRelatedCopy}}
24-
<p class="prose dark:prose-invert prose-sm mt-3">
25-
<b>Note:</b>
26-
If you're still seeing "Tests failed" after completing the steps above,
27-
<a href="#" {{on "click" this.handleViewLogsButtonClick}}>view logs</a>
28-
to troubleshoot.
29-
</p>
30-
{{/unless}}
26+
<p class="prose dark:prose-invert prose-sm mt-3">
27+
<b>Note:</b>
28+
If you're still seeing "Tests failed" after completing the steps above,
29+
<a href="#" {{on "click" this.handleViewLogsButtonClick}}>view logs</a>
30+
to troubleshoot.
31+
</p>
3132
{{/unless}}

app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ interface Signature {
88

99
Args: {
1010
isComplete: boolean;
11-
shouldHideTestRunnerCardRelatedCopy: boolean;
1211
};
1312
}
1413

app/controllers/course/stage/instructions.ts

+2-21
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ import { tracked } from '@glimmer/tracking';
44
import type AuthenticatorService from 'codecrafters-frontend/services/authenticator';
55
import type CoursePageStateService from 'codecrafters-frontend/services/course-page-state';
66
import type CourseStageModel from 'codecrafters-frontend/models/course-stage';
7-
import type FeatureFlagsService from 'codecrafters-frontend/services/feature-flags';
87
import type RepositoryModel from 'codecrafters-frontend/models/repository';
98
import type CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step';
109
import { action } from '@ember/object';
1110
import type RouterService from '@ember/routing/router-service';
1211
import { next } from '@ember/runloop';
1312
import { task } from 'ember-concurrency';
1413
import type Store from '@ember-data/store';
14+
1515
export default class CourseStageInstructionsController extends Controller {
1616
@service declare authenticator: AuthenticatorService;
1717
@service declare coursePageState: CoursePageStateService;
18-
@service declare featureFlags: FeatureFlagsService;
1918
@service declare router: RouterService;
2019
@service declare store: Store;
2120

@@ -48,10 +47,6 @@ export default class CourseStageInstructionsController extends Controller {
4847
return this.model.courseStage.prerequisiteInstructionsMarkdownFor(this.model.activeRepository);
4948
}
5049

51-
get shouldHideTestRunnerCardBeforeStage1Submission() {
52-
return this.featureFlags.cannotSeeTestRunnerCardBeforeStage1Submission;
53-
}
54-
5550
get shouldShowFeedbackPrompt() {
5651
return !this.currentStep.courseStage.isFirst && this.currentStep.status === 'complete';
5752
}
@@ -61,21 +56,7 @@ export default class CourseStageInstructionsController extends Controller {
6156
}
6257

6358
get shouldShowTestRunnerCard() {
64-
if (!this.isCurrentStage) {
65-
return false;
66-
}
67-
68-
if (this.currentStep.status === 'complete') {
69-
return false;
70-
}
71-
72-
if (this.model.courseStage.isFirst) {
73-
// For stage 1, we hide the test runner card until the user's submission.
74-
return !(this.model.activeRepository.submissionsCount <= 1 && this.shouldHideTestRunnerCardBeforeStage1Submission);
75-
} else {
76-
// For other stages, we always show the test runner card
77-
return true;
78-
}
59+
return this.isCurrentStage && this.currentStep.status !== 'complete';
7960
}
8061

8162
get shouldShowUpgradePrompt() {

app/services/feature-flags.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export default class FeatureFlagsService extends Service {
1818
return this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-short-instructions-for-stage-2') === 'test';
1919
}
2020

21-
get cannotSeeTestRunnerCardBeforeStage1Submission() {
22-
return this.currentUser?.isStaff || this.getFeatureFlagValue('cannot-see-test-runner-card-before-stage1-submission') === 'test';
21+
get canSeeTweaksForStage1() {
22+
return this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-tweaks-for-stage-1') === 'test';
2323
}
2424

2525
get currentUser() {

app/templates/course/stage/instructions.hbs

+1-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,7 @@
3333
{{/if}}
3434

3535
{{#if @model.courseStage.isFirst}}
36-
<CoursePage::CourseStageStep::FirstStageTutorialCard
37-
@repository={{@model.activeRepository}}
38-
@courseStage={{@model.courseStage}}
39-
@currentStep={{this.currentStep}}
40-
@shouldHideTestRunnerCardRelatedCopy={{this.shouldHideTestRunnerCardBeforeStage1Submission}}
41-
class="mb-6"
42-
/>
36+
<CoursePage::CourseStageStep::FirstStageTutorialCard @repository={{@model.activeRepository}} @courseStage={{@model.courseStage}} class="mb-6" />
4337
{{/if}}
4438

4539
{{#if @model.courseStage.isSecond}}

0 commit comments

Comments
 (0)