From a09ceb29539aa0e4fa8a4a813a49397702be817d Mon Sep 17 00:00:00 2001 From: facundoy Date: Mon, 11 Nov 2024 16:37:57 -0500 Subject: [PATCH] Changed implementation of provided tests so that it detects how many tests were written instead of having to type it --- src/haz3lweb/Grading.re | 29 +++++------------------------ src/haz3lweb/view/ExerciseMode.re | 1 - 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/haz3lweb/Grading.re b/src/haz3lweb/Grading.re index 5610c3d0f0..7e774b870e 100644 --- a/src/haz3lweb/Grading.re +++ b/src/haz3lweb/Grading.re @@ -61,7 +61,6 @@ module TestValidationReport = { report: t, max_points: int, max_tests: int, - prov_tests: int, settings: Settings.t, ) => { Cell.report_footer_view([ @@ -103,21 +102,6 @@ module TestValidationReport = { ), ], ), - div( - ~attrs=[Attr.class_("input-field")], - [ - label([text("Tests provided:")]), - input( - ~attrs=[ - Attr.type_("number"), - Attr.class_("point-num-input"), - Attr.id("test-provided-input"), - Attr.value(string_of_int(prov_tests)), - ], - (), - ), - ], - ), div( ~attrs=[Attr.class_("edit-icon")], [ @@ -139,13 +123,10 @@ module TestValidationReport = { ), )##.value; let new_prov_test = - Obj.magic( - Js_of_ocaml.Js.some( - JsUtil.get_elem_by_id( - "test-provided-input", - ), - ), - )##.value; + switch (report.test_results) { + | Some(test_results) => test_results.total + | None => 0 + }; let update_events = [ inject(Set(EditingTestValRep)), @@ -153,7 +134,7 @@ module TestValidationReport = { UpdateTestValRep( int_of_string(new_test_num), int_of_string(new_dist), - int_of_string(new_prov_test), + new_prov_test, ), ), ]; diff --git a/src/haz3lweb/view/ExerciseMode.re b/src/haz3lweb/view/ExerciseMode.re index e2b3d1cbd6..097a5de944 100644 --- a/src/haz3lweb/view/ExerciseMode.re +++ b/src/haz3lweb/view/ExerciseMode.re @@ -341,7 +341,6 @@ let view = grading_report.test_validation_report, grading_report.point_distribution.test_validation, eds.your_tests.required, - eds.your_tests.provided, settings, ), ],