Skip to content

Commit

Permalink
added test case and check mark functionality, but need to hide it if …
Browse files Browse the repository at this point in the history
…test not complete (still needs to be done)
  • Loading branch information
reevafaisal committed Feb 10, 2025
1 parent 5bb7c4b commit 59defe3
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 17 deletions.
95 changes: 93 additions & 2 deletions src/haz3lweb/exercises/examples/Tu_More.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 27 additions & 15 deletions src/haz3lweb/view/TutorialMode.re
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ module Selection = {
);
};
};

module View = {
type event =
| MakeActive(Selection.t);
Expand Down Expand Up @@ -296,7 +297,6 @@ module View = {
let eds = model.editors;
let {user_impl, instructor, hidden_tests}: Tutorial.stitched('a) =
model.cells;

// Printf.printf(
// "User Impl Before View: %s\n",
// CellEditor.Model.show(user_impl),
Expand All @@ -310,10 +310,14 @@ module View = {
cell_editor.result |> EvalResult.Model.make_test_report,
model.cells,
);
let test_count =
switch (Tutorial.get_stitched(HiddenTests, stitched_tests)) {
| None => 0 /* No test cases */
| Some(test_results) => test_results.total
};
let grading_report =
TutorialGrading.GradingReport.mk(eds, ~stitched_tests);
// let score_view =
// TutorialGrading.GradingReport.view_overall_score(grading_report);

let editor_view =
(
~caption: string,
Expand Down Expand Up @@ -364,25 +368,33 @@ module View = {
// Printf.printf(
// "User Impl After View: %s\n",
// CellEditor.Model.show(user_impl),
// );
// ):

let hidden_tests_view =
InstructorOnly(
() => editor_view(HiddenTests, hidden_tests, ~caption="Hidden Tests"),
);
let impl_grading_view =
Always(
TutorialGrading.ImplGradingReport.view(
~signal_jump=
id =>
inject(
Editor(
HiddenTests,
MainEditor(Perform(Jump(TileId(id)))),
if (test_count == 1) {
div(
~attrs=[Attr.class_("checkmark-container")],
[div(~attrs=[Attr.class_("checkmark")], [text("✅")])],
);
} else {
TutorialGrading.ImplGradingReport.view(
~signal_jump=
id =>
inject(
Editor(
HiddenTests,
MainEditor(Perform(Jump(TileId(id)))),
),
),
),
~report=grading_report.impl_grading_report,
~max_points=1,
),
~report=grading_report.impl_grading_report,
~max_points=1,
);
},
);
[title_view, prompt_view]
@ render_cells(
Expand Down
12 changes: 12 additions & 0 deletions src/haz3lweb/www/style/tutorial-mode.css
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,16 @@
#main.Tutorial .context-entry {
max-width: fit-content; /* Correct implementation type sigs */

}
#main.Tutorial.checkmark {
font-size: 4rem !important; /* Increase size */
font-weight: bold !important;
/* color: green !important; Force green color */
text-align: right !important; /* Align to right */
display: block !important;
padding-right: 30px !important; /* Extra spacing */
}
#main.checkmark-container {
display: flex;
justify-content: flex-end; /* Push checkmark to the right */
}

0 comments on commit 59defe3

Please sign in to comment.