Skip to content

Commit

Permalink
add contact id to online survey url params
Browse files Browse the repository at this point in the history
  • Loading branch information
timohuber committed Sep 24, 2024
1 parent 54156e7 commit 694b510
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pool/app/experiment/entity.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,24 @@ module OnlineExperiment = struct
|> Pool_tenant.(create_public_url tenant.url)
;;

let url_params tenant ~experiment_id ~assignment_id =
let url_params tenant ~experiment_id ~assignment_id ~contact_id =
let open Pool_common in
[ "assignmentId", Id.value assignment_id
; "experimentId", Id.value experiment_id
; "contactId", Id.value assignment_id
; "experimentId", Id.value contact_id
; ( Pool_message.Field.(show CallbackUrl)
, callback_url tenant ~experiment_id ~assignment_id )
]
;;

let render_survey_url tenant ~experiment_id ~assignment_id survey_url =
let params = url_params tenant ~experiment_id ~assignment_id in
let render_survey_url
tenant
~experiment_id
~assignment_id
~contact_id
survey_url
=
let params = url_params tenant ~experiment_id ~assignment_id ~contact_id in
Utils.Message.render_params params survey_url
;;
end
Expand Down
2 changes: 2 additions & 0 deletions pool/app/experiment/experiment.mli
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ module OnlineExperiment : sig
: Pool_tenant.t
-> experiment_id:Id.t
-> assignment_id:Pool_common.Id.t
-> contact_id:Pool_common.Id.t
-> (string * string) list

val render_survey_url
: Pool_tenant.t
-> experiment_id:Id.t
-> assignment_id:Pool_common.Id.t
-> contact_id:Pool_common.Id.t
-> SurveyUrl.t
-> string
end
Expand Down
1 change: 1 addition & 0 deletions pool/web/handler/contact_experiment.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ module OnlineSurvey = struct
tenant
~experiment_id
~assignment_id:(Assignment.Id.to_common assignment_id)
~contact_id:Contact.(id contact |> Id.to_common)
in
let* time_window =
Time_window.find_current_by_experiment
Expand Down
2 changes: 2 additions & 0 deletions pool/web/view/component/component_message_text_elements.ml
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@ let online_survey_help tenant ?experiment () =
let open DummyData in
let assignment = create_assignment () in
let experiment = CCOption.value ~default:(create_experiment ()) experiment in
let contact_id = Contact.Id.(create () |> to_common) in
Experiment.OnlineExperiment.url_params
tenant
~experiment_id:experiment.Experiment.id
~assignment_id:Assignment.(assignment.id |> Id.to_common)
~contact_id
;;

0 comments on commit 694b510

Please sign in to comment.