Skip to content

Commit 3c781cb

Browse files
AltGrerikmd
authored andcommitted
fix(API): Fix listing exercise status when the status list hasn't been initialized; Fix #314
1 parent 03d871a commit 3c781cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/state/learnocaml_store.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@ module Exercise = struct
203203
List.iter (fun st -> Hashtbl.add tbl st.id st) l;
204204
tbl)
205205
@@ function
206-
| Unix.Unix_error (Unix.ENOENT, _, _) -> Lwt.return tbl
206+
| Unix.Unix_error (Unix.ENOENT, _, _) ->
207+
Lazy.force !index >>= fun index ->
208+
Exercise.Index.fold_exercises (fun () id _ ->
209+
Hashtbl.add tbl id (Exercise.Status.default id))
210+
() index;
211+
Lwt.return tbl
207212
| e -> Lwt.fail e
208213
)
209214

0 commit comments

Comments
 (0)