From 59fb7680d5c9c3416d1c76dac5aa493d255fd0e4 Mon Sep 17 00:00:00 2001 From: Andy Li Date: Fri, 27 Dec 2024 05:14:03 +0800 Subject: [PATCH] Revert "Experiment: Stage 1 - Hide Test Runner Card Before User Has Submitted Again" --- .../first-stage-tutorial-card.hbs | 51 +++++-------------- .../first-stage-tutorial-card.ts | 13 ----- .../submit-code-step.hbs | 19 +++---- .../submit-code-step.ts | 1 - app/controllers/course/stage/instructions.ts | 23 +-------- app/services/feature-flags.js | 4 +- app/templates/course/stage/instructions.hbs | 8 +-- 7 files changed, 29 insertions(+), 90 deletions(-) diff --git a/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs b/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs index 076b1ba4d..c9b5661b4 100644 --- a/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs +++ b/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs @@ -21,45 +21,22 @@ @isComplete={{this.uncommentCodeStepIsComplete}} /> {{else if (eq stepList.expandedStep.id "submit-code")}} - + {{/if}} - {{#if @shouldHideTestRunnerCardRelatedCopy}} - {{#if this.shouldShowLinkToForum}} -
-

Need help?

- -
- {{/if}} - {{else}} - {{! After step 2, step 3 already contains a note on Tests Failed, so we can hide this !}} - {{#unless this.uncommentCodeStepIsComplete}} -
-

- {{svg-jar "information-circle" class="w-5 h-5 mb-1 inline-flex text-sky-500"}} - Note: - After your first Git push, you should see - Tests failed - in the bar below this card. This is expected! Complete the steps above to pass the tests. -

-
- {{/unless}} - {{/if}} + {{! After step 2, step 3 already contains a note on Tests Failed, so we can hide this !}} + {{#unless this.uncommentCodeStepIsComplete}} +
+

+ {{svg-jar "information-circle" class="w-5 h-5 mb-1 inline-flex text-sky-500"}} + Note: + After your first Git push, you should see + Tests + failed + in the bar below this card. This is expected! Complete the steps above to pass the tests. +

+
+ {{/unless}} \ No newline at end of file diff --git a/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts b/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts index 833b2a7da..22329a74e 100644 --- a/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts +++ b/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts @@ -4,7 +4,6 @@ import CoursePageStateService from 'codecrafters-frontend/services/course-page-s import FeatureFlagsService from 'codecrafters-frontend/services/feature-flags'; import Store from '@ember-data/store'; import type CourseStageModel from 'codecrafters-frontend/models/course-stage'; -import type CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step'; import type RepositoryModel from 'codecrafters-frontend/models/repository'; import type { Step } from 'codecrafters-frontend/components/expandable-step-list'; import { action } from '@ember/object'; @@ -15,8 +14,6 @@ interface Signature { Args: { repository: RepositoryModel; courseStage: CourseStageModel; - currentStep: CourseStageStep; - shouldHideTestRunnerCardRelatedCopy: boolean; }; } @@ -73,10 +70,6 @@ export default class FirstStageTutorialCardComponent extends Component

- Once you run the commands above, our system will automatically test your code. + Once you run the commands above, the + Tests failed + message below this card will change to + Tests passed.

{{#if @isComplete}} @@ -20,12 +23,10 @@ {{#unless @isComplete}} - {{#unless @shouldHideTestRunnerCardRelatedCopy}} -

- Note: - If you're still seeing "Tests failed" after completing the steps above, - view logs - to troubleshoot. -

- {{/unless}} +

+ Note: + If you're still seeing "Tests failed" after completing the steps above, + view logs + to troubleshoot. +

{{/unless}} \ No newline at end of file diff --git a/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts b/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts index d6c56f9fc..a10c576ed 100644 --- a/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts +++ b/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts @@ -8,7 +8,6 @@ interface Signature { Args: { isComplete: boolean; - shouldHideTestRunnerCardRelatedCopy: boolean; }; } diff --git a/app/controllers/course/stage/instructions.ts b/app/controllers/course/stage/instructions.ts index 798eccfe0..132665df7 100644 --- a/app/controllers/course/stage/instructions.ts +++ b/app/controllers/course/stage/instructions.ts @@ -4,7 +4,6 @@ import { tracked } from '@glimmer/tracking'; import type AuthenticatorService from 'codecrafters-frontend/services/authenticator'; import type CoursePageStateService from 'codecrafters-frontend/services/course-page-state'; import type CourseStageModel from 'codecrafters-frontend/models/course-stage'; -import type FeatureFlagsService from 'codecrafters-frontend/services/feature-flags'; import type RepositoryModel from 'codecrafters-frontend/models/repository'; import type CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step'; import { action } from '@ember/object'; @@ -12,10 +11,10 @@ import type RouterService from '@ember/routing/router-service'; import { next } from '@ember/runloop'; import { task } from 'ember-concurrency'; import type Store from '@ember-data/store'; + export default class CourseStageInstructionsController extends Controller { @service declare authenticator: AuthenticatorService; @service declare coursePageState: CoursePageStateService; - @service declare featureFlags: FeatureFlagsService; @service declare router: RouterService; @service declare store: Store; @@ -48,10 +47,6 @@ export default class CourseStageInstructionsController extends Controller { return this.model.courseStage.prerequisiteInstructionsMarkdownFor(this.model.activeRepository); } - get shouldHideTestRunnerCardBeforeStage1Submission() { - return this.featureFlags.cannotSeeTestRunnerCardBeforeStage1Submission; - } - get shouldShowFeedbackPrompt() { return !this.currentStep.courseStage.isFirst && this.currentStep.status === 'complete'; } @@ -61,21 +56,7 @@ export default class CourseStageInstructionsController extends Controller { } get shouldShowTestRunnerCard() { - if (!this.isCurrentStage) { - return false; - } - - if (this.currentStep.status === 'complete') { - return false; - } - - if (this.model.courseStage.isFirst) { - // For stage 1, we hide the test runner card until the user's submission. - return !(this.model.activeRepository.submissionsCount <= 1 && this.shouldHideTestRunnerCardBeforeStage1Submission); - } else { - // For other stages, we always show the test runner card - return true; - } + return this.isCurrentStage && this.currentStep.status !== 'complete'; } get shouldShowUpgradePrompt() { diff --git a/app/services/feature-flags.js b/app/services/feature-flags.js index d5f34c3fd..c3dd77615 100644 --- a/app/services/feature-flags.js +++ b/app/services/feature-flags.js @@ -18,8 +18,8 @@ export default class FeatureFlagsService extends Service { return this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-short-instructions-for-stage-2') === 'test'; } - get cannotSeeTestRunnerCardBeforeStage1Submission() { - return this.currentUser?.isStaff || this.getFeatureFlagValue('cannot-see-test-runner-card-before-stage1-submission') === 'test'; + get canSeeTweaksForStage1() { + return this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-tweaks-for-stage-1') === 'test'; } get currentUser() { diff --git a/app/templates/course/stage/instructions.hbs b/app/templates/course/stage/instructions.hbs index c654faaa8..b34a1f916 100644 --- a/app/templates/course/stage/instructions.hbs +++ b/app/templates/course/stage/instructions.hbs @@ -33,13 +33,7 @@ {{/if}} {{#if @model.courseStage.isFirst}} - + {{/if}} {{#if @model.courseStage.isSecond}}