Skip to content

Commit 3d5ea5a

Browse files
authored
Visible scores hidden output for overlay grader (#34)
1 parent ef1c639 commit 3d5ea5a

File tree

5 files changed

+35
-12
lines changed

5 files changed

+35
-12
lines changed

dist/grading/types.d.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/grading/graders/OverlayGrader.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,26 @@ export class OverlayGrader extends Grader<OverlayPawtograderConfig> {
293293
return [
294294
{
295295
name: unit.name,
296-
output: `**Tests passed: ${passingTests} / ${expectedTests}**\n${relevantTestResults
297-
.sort((a, b) => a.name.localeCompare(b.name))
298-
.map(
299-
(result) =>
300-
` * ${icon(result)} ${result.name} ${result.output ? '\n```\n' + result.output + '\n```' : ''}`
301-
)
302-
.join('\n')}`,
296+
output: unit.hide_output
297+
? 'Output for this test is intentionally hidden.'
298+
: `**Tests passed: ${passingTests} / ${expectedTests}**\n${relevantTestResults
299+
.sort((a, b) => a.name.localeCompare(b.name))
300+
.map(
301+
(result) =>
302+
` * ${icon(result)} ${result.name} ${result.output ? '\n```\n' + result.output + '\n```' : ''}`
303+
)
304+
.join('\n')}`,
303305
output_format: 'markdown',
306+
hidden_output: unit.hide_output
307+
? `**Tests passed: ${passingTests} / ${expectedTests}**\n${relevantTestResults
308+
.sort((a, b) => a.name.localeCompare(b.name))
309+
.map(
310+
(result) =>
311+
` * ${icon(result)} ${result.name} ${result.output ? '\n```\n' + result.output + '\n```' : ''}`
312+
)
313+
.join('\n')}`
314+
: undefined,
315+
hidden_output_format: unit.hide_output ? 'markdown' : undefined,
304316
score,
305317
hide_until_released: part.hide_until_released,
306318
max_score: unit.points

src/grading/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export interface RegularTestUnit {
8383
points: number
8484
testCount: number
8585
allow_partial_credit?: boolean
86+
hide_output?: boolean
8687
}
8788

8889
// Combined graded unit type

0 commit comments

Comments
 (0)