Commit 1f5934ab authored by Stephane Glondu's avatar Stephane Glondu

Reduce the scopes of "open Question_std_t"

parent ed72e88f
......@@ -22,7 +22,6 @@
open Js_of_ocaml
open Platform
open Serializable_builtin_t
open Question_std_t
open Serializable_j
open Signatures
open Common
......@@ -72,6 +71,7 @@ let progress_step n =
in ()
let rec createQuestionNode sk params question_div num_questions i prev (Question.Standard q, answers) next =
let open Question_std_t in
(* Create div element for the current question. [i] and [(q,
answers)] point to the current question. [List.rev prev @ [q,
answers] @ next] is the list of all questions. *)
......
......@@ -20,7 +20,6 @@
(**************************************************************************)
open Js_of_ocaml
open Question_std_t
open Serializable_j
open Tool_js_common
......@@ -66,6 +65,7 @@ let extractQuestion q =
in
if (q_max > Array.length q_answers) then
failwith "Maximum number of choices is greater than number of choices!";
let open Question_std_t in
return (Question.Standard {q_question; q_blank; q_min; q_max; q_answers})
let extractTemplate () =
......@@ -119,6 +119,7 @@ let rec createAnswer a =
container
let rec createQuestion (Question.Standard q) =
let open Question_std_t in
let container = Dom_html.createDiv document in
(* question text and remove/insert buttons *)
let x = Dom_html.createDiv document in
......@@ -249,6 +250,7 @@ let createTemplate template =
let b = Dom_html.createButton document in
let t = document##createTextNode (Js.string "Add a question") in
let f _ =
let open Question_std_t in
let x = createQuestion (Question.Standard {q_question=""; q_blank=None; q_min=0; q_max=1; q_answers=[||]}) in
Dom.appendChild h_questions_div x
in
......
......@@ -23,7 +23,6 @@ open Lwt
open Platform
open Common
open Serializable_builtin_t
open Question_std_t
open Serializable_t
open Web_serializable_builtin_t
open Web_serializable_j
......@@ -415,6 +414,7 @@ let unwebize_trustee_public_key pk =
let default_contact = "Name <user@example.org>"
let default_questions =
let open Question_std_t in
let question = {
q_answers = [| "Answer 1"; "Answer 2"; "Answer 3" |];
q_blank = None;
......
......@@ -21,7 +21,6 @@
open Lwt
open Serializable_builtin_t
open Question_std_t
open Serializable_j
open Signatures
open Common
......@@ -1754,6 +1753,7 @@ let election_home election state () =
let questions = Array.to_list election.e_params.e_questions in
return @@ div [
ul (List.mapi (fun i (Question.Standard x) ->
let open Question_std_t in
let answers = Array.to_list x.q_answers in
let answers = match x.q_blank with
| Some true -> L.blank_vote :: answers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment