Skip to content

Commit 8afa985

Browse files
committed
Fix C lesson visualization step coverage
1 parent 96916da commit 8afa985

6 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/backend/prisma/content/c/lessons/c-1-5.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
{
260260
"title": "프로그램 종료",
261261
"explanation": "`return 0;`으로 프로그램을 정상 종료합니다.\n\n핵심은 간단합니다: for문은 \"횟수가 비교적 명확한 반복\"에 가장 읽기 쉽고 안전합니다.",
262+
"visualizationType": "cMemory",
262263
"code": "return 0;",
263264
"stack": []
264265
}

packages/backend/prisma/content/c/lessons/c-1-6.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
{
4343
"title": "while 조건 검사 (n = 1)",
4444
"explanation": "`n <= 4`가 참인지 먼저 검사하고, 참이면 본문을 실행합니다.\n\nwhile은 조건 중심 반복문이라 조건 변화 코드를 빠뜨리면 무한 루프가 되기 쉽습니다.",
45+
"visualizationType": "cMemory",
4546
"code": "while (n <= 4) {"
4647
},
4748
{
@@ -112,6 +113,7 @@
112113
{
113114
"title": "반복 종료 (n = 8)",
114115
"explanation": "`n=8`이 되면 `8 <= 4`가 거짓이므로 while이 종료됩니다.\n\n루프 탈출 시 변수 값은 \"마지막 실행값\"이 아니라 \"조건을 깨뜨린 값\"일 수 있습니다.",
116+
"visualizationType": "cMemory",
115117
"code": "while (n <= 4) {"
116118
},
117119
{
@@ -123,6 +125,7 @@
123125
{
124126
"title": "프로그램 종료",
125127
"explanation": "`return 0;`으로 프로그램을 정상 종료합니다.\n\n이 예제의 핵심은 while에서 조건과 갱신을 직접 관리해야 한다는 점입니다.",
128+
"visualizationType": "cMemory",
126129
"code": "return 0;",
127130
"stack": []
128131
}

packages/backend/prisma/content/c/lessons/c-1-7.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@
233233
{
234234
"title": "프로그램 종료",
235235
"explanation": "`return 0;`으로 main이 종료되며 지역 변수들이 정리됩니다.\n\n함수 호출 핵심 흐름은 값 복사 전달 -> 계산 -> return으로 결과 반환입니다.",
236+
"visualizationType": "cMemory",
236237
"code": "return 0;",
237238
"stack": []
238239
}

packages/backend/prisma/content/c/lessons/c-11-1.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
{
9292
"title": "프로그램 종료",
9393
"explanation": "**`return 0;`** — 조건 분기가 끝나고 프로그램이 정상 종료됩니다. `return 0`은 운영체제에게 \"문제 없이 끝났다\"는 신호이며, main의 스택 프레임이 해제되면서 `temperature`도 메모리에서 사라집니다.",
94+
"visualizationType": "cMemory",
9495
"code": "return 0;",
9596
"stack": []
9697
}

packages/backend/prisma/content/c/lessons/c-11-2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
{
9393
"title": "프로그램 종료",
9494
"explanation": "**`return 0;`** — switch를 빠져나온 후 프로그램이 정상 종료됩니다. main의 스택 프레임이 해제되면서 `day`도 메모리에서 사라집니다.",
95+
"visualizationType": "cMemory",
9596
"code": "return 0;",
9697
"stack": []
9798
}

packages/frontend/src/features/courses/utils/visualizationData.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export const VIZ_DATA_FIELDS = [
2727
] as const;
2828

2929
export function hasVisualizationData(step: LessonStep): boolean {
30-
const stepRecord = step as UnknownRecord;
31-
if (step.visualizationType === 'terminal') {
30+
if (typeof step.visualizationType === 'string' && step.visualizationType.trim().length > 0) {
3231
return true;
3332
}
33+
const stepRecord = step as UnknownRecord;
3434
return VIZ_DATA_FIELDS.some((field) => hasMeaningfulValue(stepRecord[field]));
3535
}
3636

@@ -71,4 +71,3 @@ export function hasJavaMemoryData(steps: LessonStep[]): boolean {
7171
return hasMeaningfulValue(s.javaMemoryState);
7272
});
7373
}
74-

0 commit comments

Comments
 (0)