Skip to content

Commit

Permalink
upate num_show_ups
Browse files Browse the repository at this point in the history
  • Loading branch information
timohuber committed Aug 15, 2023
1 parent b8abc72 commit facb1e4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions pool/app/contact_counter/contact_counter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,23 @@ let update_on_assignment_update
let open Assignment in
let open Contact in
let open CCOption.Infix in
(* update_num_show_ups is missing *)
let contact =
let open NoShow in
match no_show >|= value, updated_no_show >|= value with
| Some true, (Some false | None) -> update_num_no_shows ~step:(-1) contact
| (Some false | None), Some true -> update_num_no_shows ~step:1 contact
| None, None | Some _, Some _ | Some _, None | None, Some false -> contact
match no_show >|= value, updated_no_show |> value with
| Some true, false ->
contact |> update_num_no_shows ~step:(-1) |> update_num_show_ups ~step:1
| (Some false | None), true ->
contact |> update_num_no_shows ~step:1 |> update_num_show_ups ~step:(-1)
| Some true, true | Some false, false | None, false -> contact
in
let contact =
let open NoShow in
if participated_in_other_assignments
then contact
else (
match no_show >|= value, updated_no_show >|= value with
| Some true, (Some false | None) ->
update_num_participations ~step:1 contact
| Some false, (Some true | None) ->
update_num_participations ~step:(-1) contact
match no_show >|= value, updated_no_show |> value with
| Some true, false -> update_num_participations ~step:1 contact
| Some false, true -> update_num_participations ~step:(-1) contact
| _ -> contact)
in
contact
Expand Down
2 changes: 1 addition & 1 deletion pool/app/contact_counter/contact_counter.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ val update_on_assignment_deletion

val update_on_assignment_update
: Assignment.t
-> Assignment.NoShow.t option
-> Assignment.NoShow.t
-> bool
-> Contact.t
2 changes: 1 addition & 1 deletion pool/cqrs_command/assignment_command.ml
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ end = struct
let contact_counters =
Contact_counter.update_on_assignment_update
assignment
(Some no_show)
no_show
participated_in_other_assignments
|> Contact.updated
|> Pool_event.contact
Expand Down

0 comments on commit facb1e4

Please sign in to comment.