From e4626cd285f8446cc30940e0bce8daad092221a8 Mon Sep 17 00:00:00 2001 From: russell-rozenbaum Date: Sat, 21 Dec 2024 11:10:17 -0500 Subject: [PATCH] puts captions and subcaptions from perspective of instructor when in instructor mode --- src/haz3lweb/exercises/Grading.re | 33 +++++++++++++++++-------------- src/haz3lweb/view/ExerciseMode.re | 29 ++++++++++++++++----------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/haz3lweb/exercises/Grading.re b/src/haz3lweb/exercises/Grading.re index 8ea20241cd..03b7f5a7d6 100644 --- a/src/haz3lweb/exercises/Grading.re +++ b/src/haz3lweb/exercises/Grading.re @@ -655,24 +655,25 @@ module MutationTestingReport = { let view = ( - ~globals, + ~globals: Globals.t, ~editing_mut_test_rep, ~inject_editing_mut_test_rep, ~inject_update_mut_test_rep, ~select_textbox, report: t, max_points: int, - ) => + ) => { + let subcaption = + globals.settings.instructor_mode + ? ": Student Tests vs. Mutant Implementations" + : ": Your Tests vs. Mutant Implementations (hidden)"; if (max_points < 0) { Node.div([]); } else { CellCommon.panel( ~classes=["test-panel"], [ - CellCommon.caption( - "Mutation Testing", - ~rest=": Your Tests vs. Buggy Implementations (hidden)", - ), + CellCommon.caption("Mutation Testing", ~rest=subcaption), individual_reports( report.results, ~editing_mut_test_rep, @@ -694,6 +695,7 @@ module MutationTestingReport = { ), ); }; + }; }; module SyntaxReport = { @@ -802,14 +804,14 @@ module SyntaxReport = { ~select_textbox, syntax_report: t, ) => { + let subcaption = + globals.settings.instructor_mode + ? ": Does student's implementation satisfy the syntactic requirements?" + : ": Does your implementation satisfy the syntactic requirements?"; CellCommon.panel( ~classes=["test-panel"], [ - CellCommon.caption( - "Syntax Validation", - ~rest= - ": Does your implementation satisfy the syntactic requirements?", - ), + CellCommon.caption("Syntax Validation", ~rest=subcaption), individual_reports( syntax_report.hinted_results, ~editing_syntax_rep, @@ -1115,13 +1117,14 @@ module ImplGradingReport = { ~syntax_report: SyntaxReport.t, ~max_points: int, ) => { + let subcaption = + globals.settings.instructor_mode + ? ": Hidden Tests vs. Student's Implementation" + : ": Hidden Tests vs. Your Implementation"; CellCommon.panel( ~classes=["test-panel"], [ - CellCommon.caption( - "Implementation Grading", - ~rest=": Hidden Tests vs. Your Implementation", - ), + CellCommon.caption("Implementation Grading", ~rest=subcaption), individual_reports( ~signal_jump, ~report, diff --git a/src/haz3lweb/view/ExerciseMode.re b/src/haz3lweb/view/ExerciseMode.re index a82c410046..4ec4e787f3 100644 --- a/src/haz3lweb/view/ExerciseMode.re +++ b/src/haz3lweb/view/ExerciseMode.re @@ -872,13 +872,17 @@ module View = { }, ); - let your_tests_view = + let your_tests_view = { + let subcaption = + globals.settings.instructor_mode + ? ": Student Tests vs. Correct Implementation" + : ": Your Tests vs. Correct Implementation"; Always( editor_view( YourTestsValidation, test_validation, ~caption="Test Validation", - ~subcaption=": Your Tests vs. Correct Implementation", + ~subcaption, ~result_kind= Custom( Grading.TestValidationReport.view( @@ -904,6 +908,7 @@ module View = { ), ), ); + }; let wrong_impl_views = List.mapi( @@ -967,13 +972,11 @@ module View = { ); let your_impl_view = { + let caption = + globals.settings.instructor_mode + ? "Student's Implementation" : "Your Implementation"; Always( - editor_view( - YourImpl, - user_impl, - ~caption="Your Implementation", - ~result_kind=EvalResults, - ), + editor_view(YourImpl, user_impl, ~caption, ~result_kind=EvalResults), ); }; @@ -991,17 +994,21 @@ module View = { ), ); - let impl_validation_view = + let impl_validation_view = { + let subcaption = + globals.settings.instructor_mode + ? ": Student's Tests vs. Student's Implementation" + : ": Your Tests (code synchronized with Test Validation cell above) vs. Your Implementation"; Always( editor_view( YourTestsTesting, user_tests, ~caption="Implementation Validation", - ~subcaption= - ": Your Tests (code synchronized with Test Validation cell above) vs. Your Implementation", + ~subcaption, ~result_kind=TestResults, ), ); + }; let hidden_tests_view = InstructorOnly(