Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timohuber committed Nov 13, 2024
1 parent 333b267 commit 579705c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
20 changes: 16 additions & 4 deletions pool/cqrs_command/experiment_command.ml
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ module CreateFilter : sig
val handle
: ?tags:Logs.Tag.set
-> Experiment.t
-> Assignment.event list * Email.dispatch list
-> t
-> (Pool_event.t list, Pool_message.Error.t) result

Expand All @@ -559,7 +560,12 @@ end = struct
Filter.create ~id None query |> return
;;

let handle ?(tags = Logs.Tag.empty) experiment filter =
let handle
?(tags = Logs.Tag.empty)
experiment
(assignment_events, emails)
filter
=
Logs.info ~src (fun m -> m "Handle command CreateFilter" ~tags);
let open CCResult in
let updated =
Expand All @@ -568,10 +574,16 @@ end = struct
; matcher_notification_sent = MatcherNotificationSent.create false
}
in
let assignment_events =
assignment_events |> CCList.map Pool_event.assignment
in
let email_event = Email.BulkSent emails |> Pool_event.email in
Ok
[ Filter.Created filter |> Pool_event.filter
; Experiment.Updated (experiment, updated) |> Pool_event.experiment
]
([ Filter.Created filter |> Pool_event.filter
; Experiment.Updated (experiment, updated) |> Pool_event.experiment
]
@ assignment_events
@ [ email_event ])
;;

let effects id =
Expand Down
3 changes: 2 additions & 1 deletion pool/web/handler/admin_filter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ let write action req =
| None ->
let open CreateFilter in
let* filter = create_filter key_list template_list query |> lift in
handle ~tags exp filter |> lift
let* matcher_events = matcher_events filter in
handle ~tags exp matcher_events filter |> lift
| Some filter ->
let open UpdateFilter in
let* updated =
Expand Down

0 comments on commit 579705c

Please sign in to comment.