Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise Mode Editing Capabilities #1316

Closed
wants to merge 88 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
9989097
init
russell-rozenbaum Jun 13, 2024
1c53e11
title-box added
russell-rozenbaum Jun 22, 2024
63ccab7
added ability to change display between div/text-box depending on ins…
russell-rozenbaum Jun 22, 2024
c52269e
added functionality to switch between an edit state and finalized sta…
russell-rozenbaum Jun 24, 2024
52bbf77
added functionality to disable (set to read only) any editors while u…
russell-rozenbaum Jun 24, 2024
bde06c2
added disabling of editing_title when switching between exercise slid…
russell-rozenbaum Jun 24, 2024
80ec611
updating module name as well now
russell-rozenbaum Jun 24, 2024
5edf1c9
added an edit symbol
russell-rozenbaum Jun 24, 2024
294f669
updated UI with pencil icon wobble and positioning
russell-rozenbaum Jun 25, 2024
968fe1c
fixed bug with resetting code in editors; fixed bug with not saving w…
russell-rozenbaum Jun 26, 2024
6ffc5cf
added UI for creating and deleting buggy implementations (the buttons…
russell-rozenbaum Jun 27, 2024
a1e82bf
added functionality for creating and deleting buggy implementations; …
russell-rozenbaum Jun 27, 2024
7ea356a
added functionality for creating and deleting buggy implementations; …
russell-rozenbaum Jul 10, 2024
69fea7f
fixed bug with refreshing page while editing title causes code editor…
russell-rozenbaum Jul 23, 2024
45c783a
replaced local storage key system with Uuidm.t types rather than (key…
russell-rozenbaum Aug 3, 2024
fbd81a0
Mutant Add Delete and Title Editor (#1352)
russell-rozenbaum Aug 3, 2024
8374866
changed some string displays for mutation testing; still need to save…
russell-rozenbaum Aug 3, 2024
a2494c9
changed some string displays for mutation testing; still need to save…
russell-rozenbaum Aug 3, 2024
0ab1240
changed some string displays for mutation testing; still need to save…
russell-rozenbaum Aug 3, 2024
4c56ad5
Init
facundoy Aug 5, 2024
30c1035
fixed bugs with some editors not being disabled when editing title
russell-rozenbaum Aug 5, 2024
0488b01
Added a prompt_action type and added a placeholder for UpdatePrompt i…
facundoy Aug 5, 2024
e892a55
Changed implementation of narrative_cell
facundoy Aug 5, 2024
ebdaefb
reverted changes to exclusively title-editor w/ bugs resolved
russell-rozenbaum Aug 6, 2024
b487d0f
Merge branch 'dev' into title-editor
russell-rozenbaum Aug 6, 2024
612009a
merging to use UUIDs and title-editing properties
russell-rozenbaum Aug 7, 2024
73d7a5e
CHanged implementation of how prompt cell is viewed
facundoy Aug 11, 2024
a576e7a
Added functionality to toggle between edit and finalized state
facundoy Aug 11, 2024
b0a6a1c
Style fix
facundoy Aug 11, 2024
1a5e7a4
Changed type of prompt to string
facundoy Aug 17, 2024
b76d628
Changed implementation of prompt_view so that it changed string to ma…
facundoy Aug 17, 2024
887fa6c
resolved merge conflicts with dev
russell-rozenbaum Aug 17, 2024
229b969
fixed build failure
russell-rozenbaum Aug 17, 2024
d31a338
build and runs locally
russell-rozenbaum Aug 17, 2024
ac146e5
merge conflicts resolved; css still outdated
russell-rozenbaum Aug 17, 2024
f630de6
css updated
russell-rozenbaum Aug 17, 2024
e272d4f
Merge remote-tracking branch 'origin/mutant-add-delete' into title-ed…
russell-rozenbaum Aug 18, 2024
8da0866
Solved a bug where editing mode persisted when changing between exerc…
facundoy Aug 25, 2024
0d75c71
Added an edit button
facundoy Aug 25, 2024
757ef6b
Implemented initial animation for edit button
facundoy Aug 25, 2024
6a040f5
Added more icons and initial attempts to solve saving issues
facundoy Aug 26, 2024
52b5342
Changes done are now saved during page refreshes
facundoy Aug 27, 2024
93056b4
Increased size of textbox
facundoy Aug 30, 2024
bc305e6
Fixed a bug where the prompt would not display correctly after editin…
facundoy Aug 30, 2024
1c92865
Improved icons animations and code display, and improved code to allo…
facundoy Aug 30, 2024
7398692
Deleted print_endline statements
facundoy Aug 30, 2024
431da05
Style changes
facundoy Aug 30, 2024
de89550
Changed files to solve conflicts with dev
facundoy Sep 16, 2024
5adc764
Updated local dependencies and fixed conflict in Diag.re
facundoy Sep 16, 2024
8a05827
Added relevant update actions
facundoy Sep 22, 2024
bb11475
Added functionality to toggle between editing and finalized states
facundoy Sep 22, 2024
c44374d
Adding code that got deleted during the merge
facundoy Sep 22, 2024
bf68618
Adding code that got deleted during the merge
facundoy Sep 22, 2024
49d91b4
Solved bug where editing mode persisted between exercises
facundoy Sep 22, 2024
a938192
PersistentState type made into record field, now also storing hidden …
russell-rozenbaum Sep 27, 2024
5514fc5
Implemented the storing/exporting of new changes
facundoy Sep 28, 2024
824969a
Changed actions from edited data to edited section
facundoy Sep 28, 2024
ddd2b87
Implemented text-box and icons for editing the test validation report…
facundoy Sep 29, 2024
869917f
Implemented editable 'provided tests' in the Test Validation Report
facundoy Oct 6, 2024
746a54b
Fixed a bug where the pencil icon appeared outside of instructor mode
facundoy Oct 6, 2024
e47f631
Implemented editable point distribution for the Mutation Testing Report
facundoy Oct 6, 2024
1b89fd3
commiting before merge with dev
russell-rozenbaum Oct 11, 2024
fa62a34
fixed bugs with deleting last/first editors
russell-rozenbaum Oct 14, 2024
c762c91
style changes
facundoy Oct 20, 2024
d26947c
Added relevant update actions and implemented the storing/exporting o…
facundoy Oct 27, 2024
84849fb
Implemented the UI for the module_name and the textbox for the editing
facundoy Oct 27, 2024
89a360e
Merge branch 'description-editor' into test-editor
facundoy Nov 9, 2024
34bede5
Changes to solve merge conflicts
facundoy Nov 9, 2024
45e6143
Solved a conflict I missed
facundoy Nov 9, 2024
c1f984d
Fixed a spelling error
facundoy Nov 9, 2024
ae33a8b
Style changes to the module name cell
facundoy Nov 9, 2024
a09ceb2
Changed implementation of provided tests so that it detects how many …
facundoy Nov 11, 2024
4dae0f6
Prevented caret scrolling (through switch in main.apply function) whe…
russell-rozenbaum Nov 17, 2024
81e0286
fixed problems with attempting to place caret on recently deleted editor
russell-rozenbaum Nov 17, 2024
02f21d4
Provided number of tests for test validation changes based on the num…
facundoy Nov 24, 2024
95a7593
Fixed caret scrolling following title-editor branch changes
facundoy Nov 25, 2024
0b040a5
Prevented caret scrolling for all editing modes and prevented caret s…
facundoy Nov 25, 2024
9e7900d
Fixed problems with attempting to place caret on recently deleted edi…
facundoy Nov 25, 2024
b5fe793
Fixed bug where the number of provided tests only updated after the n…
facundoy Nov 29, 2024
038908e
Cleaned up code by eliminating old changes
facundoy Nov 29, 2024
648612a
Fixed merging conflicts
facundoy Dec 1, 2024
ceb3088
Fixed merging conflicts
facundoy Dec 2, 2024
5dd2f0f
Correctly merged dev-branch Main with PR Main
facundoy Dec 2, 2024
c2ab67e
added placeholders for title, module name, and prompt. Should be usef…
russell-rozenbaum Dec 9, 2024
2266895
added placeholders for title, module name, and prompt. Should be usef…
russell-rozenbaum Dec 9, 2024
5092383
changed the placeholders to more common placeholder names
russell-rozenbaum Dec 10, 2024
dd717ae
Fixed a bug where double line breaks in the markdown translation was …
facundoy Dec 15, 2024
be6a571
Fixed styling issues
facundoy Dec 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
494 changes: 429 additions & 65 deletions src/haz3lschool/Exercise.re

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions src/haz3lschool/Gradescope.re
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type report = {
};
[@deriving (sexp, yojson)]
type section = {
name: string,
id: Id.t,
report,
};

Expand Down Expand Up @@ -108,18 +108,24 @@ module Main = {
let hw = name_to_exercise_export(hw_path);
let export_chapter =
hw.exercise_data
|> List.map(~f=(((name, _) as key, persistent_state)) => {
switch (find_key_opt(key, specs)) {
|> List.map(~f=((id, persistent_state)) => {
switch (find_id_opt(id, specs)) {
| Some((_n, spec)) =>
let exercise =
unpersist_state(
persistent_state,
~settings,
~spec,
~instructor_mode=true,
~editing_title=false,
~editing_prompt=false,
~editing_test_val_rep=false,
~editing_mut_test_rep=false,
~editing_impl_grd_rep=false,
~editing_module_name=false,
);
let report = exercise |> gen_grading_report;
{name, report};
{id, report};
| None => failwith("Invalid spec")
// | None => (key |> yojson_of_key |> Yojson.Safe.to_string, "?")
}
Expand Down
160 changes: 160 additions & 0 deletions src/haz3lweb/Editors.re
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
open Util;
// open Virtual_dom.Vdom;
open Haz3lcore;

[@deriving (show({with_path: false}), sexp, yojson)]
Expand Down Expand Up @@ -39,6 +40,27 @@ let put_editor = (ed: Editor.t, eds: t): t =>
Exercises(n, specs, Exercise.put_editor(exercise, ed))
};

let obtain_new_prov_tests =
(eds: t, results: ModelResults.t, ~settings: CoreSettings.t): int =>
switch (eds) {
| Exercises(_, _, exercise) =>
let stitched_dynamics =
Exercise.stitch_dynamic(
settings,
exercise,
settings.dynamics ? Some(results) : None,
);
let test_results =
ModelResult.test_results(stitched_dynamics.test_validation.result);
let new_prov_test =
switch (test_results) {
| Some(test_results) => test_results.total
| None => 0
};
new_prov_test;
| _ => 0
};

let update = (f: Editor.t => Editor.t, editors: t): t =>
editors |> get_editor |> f |> put_editor(_, editors);

Expand Down Expand Up @@ -115,6 +137,144 @@ let set_instructor_mode = (editors: t, instructor_mode: bool): t =>
)
};

let set_editing_title = (editors: t, editing: bool): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.set_editing_title(exercise, editing))
};

let update_exercise_title = (editors: t, new_title: string): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.update_exercise_title(exercise, new_title))
};

let add_buggy_impl = (~settings: CoreSettings.t, editors: t, ~editing_title) => {
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(
n,
specs,
Exercise.add_buggy_impl(~settings, exercise, ~editing_title),
)
};
};

let delete_buggy_impl = (editors: t, index: int) => {
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.delete_buggy_impl(exercise, index))
};
};

let set_editing_prompt = (editors: t, editing: bool): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.set_editing_prompt(exercise, editing))
};

let update_exercise_prompt = (editors: t, new_prompt: string): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(
n,
specs,
Exercise.update_exercise_prompt(exercise, new_prompt),
)
};

let set_editing_test_val_rep = (editors: t, editing: bool): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.set_editing_test_val_rep(exercise, editing))
};

let update_test_val_rep = (editors: t, new_test_num: int, new_dist: int): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(
n,
specs,
Exercise.update_test_val_rep(exercise, new_test_num, new_dist),
)
};

let set_editing_mut_test_rep = (editors: t, editing: bool): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.set_editing_mut_test_rep(exercise, editing))
};

let update_mut_test_rep = (editors: t, new_dist: int): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.update_mut_test_rep(exercise, new_dist))
};

let set_editing_impl_grd_rep = (editors: t, editing: bool): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.set_editing_impl_grd_rep(exercise, editing))
};

let update_impl_grd_rep = (editors: t, new_dist: int): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.update_impl_grd_rep(exercise, new_dist))
};

let set_editing_module_name = (editors: t, editing: bool): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.set_editing_module_name(exercise, editing))
};

let update_module_name = (editors: t, new_module_name: string): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(
n,
specs,
Exercise.update_module_name(exercise, new_module_name),
)
};

let update_prov_tests = (editors: t, new_prov_tests: int): t =>
switch (editors) {
| Scratch(_)
| Documentation(_) => editors
| Exercises(n, specs, exercise) =>
Exercises(n, specs, Exercise.update_prov_tests(exercise, new_prov_tests))
};

let reset_nth_slide = (~settings: CoreSettings.t, n, slides): list(Editor.t) => {
let (_, init_editors, _) = Init.startup.scratch;
let data = List.nth(init_editors, n);
Expand Down
12 changes: 12 additions & 0 deletions src/haz3lweb/Export.re
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,24 @@ let import_all = (data, ~specs) => {
let settings = Store.Settings.import(all.settings);
Store.ExplainThisModel.import(all.explainThisModel);
let instructor_mode = settings.instructor_mode;
let editing_title = settings.editing_title;
let editing_prompt = settings.editing_prompt;
let editing_test_val_rep = settings.editing_test_val_rep;
let editing_mut_test_rep = settings.editing_mut_test_rep;
let editing_impl_grd_rep = settings.editing_impl_grd_rep;
let editing_module_name = settings.editing_module_name;
Store.Scratch.import(~settings=settings.core, all.scratch);
Store.Exercise.import(
~settings=settings.core,
all.exercise,
~specs,
~instructor_mode,
~editing_title,
~editing_prompt,
~editing_test_val_rep,
~editing_mut_test_rep,
~editing_impl_grd_rep,
~editing_module_name,
);
Log.import(all.log);
};
Loading
Loading