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 7
7
module Book = struct
8
8
include Book
9
9
10
+ let featured = all |> List. filter (fun book -> book.featured)
10
11
let get_by_slug slug = List. find_opt (fun x -> String. equal slug x.slug) all
11
12
end
12
13
23
24
module Industrial_user = struct
24
25
include Industrial_user
25
26
27
+ let featured = all |> List. filter (fun user -> user.featured)
26
28
let get_by_slug slug = List. find_opt (fun x -> String. equal slug x.slug) all
27
29
end
28
30
@@ -32,6 +34,7 @@ module Packages = Packages
32
34
module Paper = struct
33
35
include Paper
34
36
37
+ let featured = all |> List. filter (fun paper -> paper.featured)
35
38
let get_by_slug slug = List. find_opt (fun x -> String. equal slug x.slug) all
36
39
end
37
40
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ module Book : sig
44
44
}
45
45
46
46
val all : t list
47
+ val featured : t list
47
48
val get_by_slug : string -> t option
48
49
end
49
50
@@ -105,6 +106,7 @@ module Industrial_user : sig
105
106
}
106
107
107
108
val all : t list
109
+ val featured : t list
108
110
val get_by_slug : string -> t option
109
111
end
110
112
@@ -130,6 +132,7 @@ module Paper : sig
130
132
}
131
133
132
134
val all : t list
135
+ val featured : t list
133
136
val get_by_slug : string -> t option
134
137
end
135
138
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 ())
4
4
let index _req = Dream. html (Ocamlorg_frontend. home () )
5
5
6
6
let 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
13
9
let tutorials = Ood.Tutorial. all in
14
10
let release = List. hd Ood.Release. all in
15
11
Dream. html (Ocamlorg_frontend. learn ~papers ~books ~release ~tutorials )
@@ -32,10 +28,7 @@ let success_story req =
32
28
| None -> not_found req
33
29
34
30
let 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
39
32
let success_stories = Ood.Success_story. all in
40
33
Dream. html (Ocamlorg_frontend. industrial_users ~users ~success_stories )
41
34
@@ -248,9 +241,7 @@ let papers req =
248
241
| None -> Ood.Paper. all
249
242
| Some search -> search_paper search Ood.Paper. all
250
243
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
254
245
Dream. html (Ocamlorg_frontend. papers ?search ~recommended_papers papers)
255
246
256
247
let tutorial req =
You can’t perform that action at this time.
0 commit comments