File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 77module Book = struct
88 include Book
99
10+ let featured = all |> List. filter (fun book -> book.featured)
1011 let get_by_slug slug = List. find_opt (fun x -> String. equal slug x.slug) all
1112end
1213
2324module Industrial_user = struct
2425 include Industrial_user
2526
27+ let featured = all |> List. filter (fun user -> user.featured)
2628 let get_by_slug slug = List. find_opt (fun x -> String. equal slug x.slug) all
2729end
2830
@@ -32,6 +34,7 @@ module Packages = Packages
3234module Paper = struct
3335 include Paper
3436
37+ let featured = all |> List. filter (fun paper -> paper.featured)
3538 let get_by_slug slug = List. find_opt (fun x -> String. equal slug x.slug) all
3639end
3740
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ module Book : sig
4444 }
4545
4646 val all : t list
47+ val featured : t list
4748 val get_by_slug : string -> t option
4849end
4950
@@ -105,6 +106,7 @@ module Industrial_user : sig
105106 }
106107
107108 val all : t list
109+ val featured : t list
108110 val get_by_slug : string -> t option
109111end
110112
@@ -130,6 +132,7 @@ module Paper : sig
130132 }
131133
132134 val all : t list
135+ val featured : t list
133136 val get_by_slug : string -> t option
134137end
135138
Original file line number Diff line number Diff line change @@ -4,12 +4,8 @@ let not_found _req = Dream.html ~code:404 (Ocamlorg_frontend.not_found ())
44let index _req = Dream. html (Ocamlorg_frontend. home () )
55
66let learn _req =
7- let papers =
8- Ood.Paper. all |> List. filter (fun (paper : Ood.Paper.t ) -> paper.featured)
9- in
10- let books =
11- Ood.Book. all |> List. filter (fun (book : Ood.Book.t ) -> book.featured)
12- in
7+ let papers = Ood.Paper. featured in
8+ let books = Ood.Book. featured in
139 let tutorials = Ood.Tutorial. all in
1410 let release = List. hd Ood.Release. all in
1511 Dream. html (Ocamlorg_frontend. learn ~papers ~books ~release ~tutorials )
@@ -32,10 +28,7 @@ let success_story req =
3228 | None -> not_found req
3329
3430let industrial_users _req =
35- let users =
36- Ood.Industrial_user. all
37- |> List. filter (fun (item : Ood.Industrial_user.t ) -> item.featured)
38- in
31+ let users = Ood.Industrial_user. featured in
3932 let success_stories = Ood.Success_story. all in
4033 Dream. html (Ocamlorg_frontend. industrial_users ~users ~success_stories )
4134
@@ -248,9 +241,7 @@ let papers req =
248241 | None -> Ood.Paper. all
249242 | Some search -> search_paper search Ood.Paper. all
250243 in
251- let recommended_papers =
252- Ood.Paper. all |> List. filter (fun (paper : Ood.Paper.t ) -> paper.featured)
253- in
244+ let recommended_papers = Ood.Paper. featured in
254245 Dream. html (Ocamlorg_frontend. papers ?search ~recommended_papers papers)
255246
256247let tutorial req =
You can’t perform that action at this time.
0 commit comments