Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit ea9b590a authored by Stephane Glondu's avatar Stephane Glondu

Do not allow election validation if questions have not been edited

parent 42ff981d
......@@ -23,6 +23,7 @@ open Lwt
open Platform
open Common
open Serializable_builtin_t
open Serializable_t
open Web_serializable_builtin_t
open Web_serializable_j
......@@ -273,6 +274,17 @@ let write_file ?uuid x lines =
let default_contact = "Name <user@example.org>"
let default_questions =
let question = {
q_answers = [| "Answer 1"; "Answer 2"; "Answer 3" |];
q_blank = None;
q_min = 1;
q_max = 2;
q_question = "Question 1?";
}
in
[| question |]
let default_creation_date = datetime_of_string "\"2018-06-06 00:00:00.000000\""
let default_validation_date = datetime_of_string "\"2015-10-01 00:00:00.000000\""
let default_tally_date = datetime_of_string "\"2018-06-06 00:00:00.000000\""
......
......@@ -20,6 +20,7 @@
(**************************************************************************)
open Signatures
open Serializable_t
open Web_serializable_t
val spool_dir : string ref
......@@ -109,6 +110,7 @@ val read_file : ?uuid:uuid -> string -> string list option Lwt.t
val write_file : ?uuid:uuid -> string -> string list -> unit Lwt.t
val default_contact : string
val default_questions : question array
val default_creation_date : datetime
val default_validation_date : datetime
......
......@@ -512,17 +512,10 @@ let create_new_election owner cred auth =
e_contact = None;
e_server_is_trustee = None;
} in
let question = {
q_answers = [| "Answer 1"; "Answer 2"; "Answer 3" |];
q_blank = None;
q_min = 1;
q_max = 2;
q_question = "Question 1?";
} in
let se_questions = {
t_description = "Description of the election.";
t_name = "Name of the election";
t_questions = [| question |];
t_questions = default_questions;
} in
let se = {
se_owner = owner;
......
......@@ -1387,8 +1387,16 @@ let election_draft_import_trustees uuid se elections =
let election_draft_confirm uuid se () =
let title = "Election " ^ se.se_questions.t_name ^ " — Validate creation" in
let voters = Printf.sprintf "%d voter(s)" (List.length se.se_voters) in
let ready = not (se.se_voters = []) in
let ready, questions =
if se.se_questions.t_questions = default_questions then
false, "Not edited"
else
true, "OK"
in
let ready, voters =
ready && not (se.se_voters = []),
Printf.sprintf "%d voter(s)" (List.length se.se_voters)
in
let ready, passwords =
match se.se_metadata.e_auth_config with
| Some [{auth_system = "password"; _}] ->
......@@ -1438,6 +1446,10 @@ let election_draft_confirm uuid se () =
| Some _ -> "Yes", pcdata ""
in
let table_checklist = table [
tr [
td [pcdata "Questions?"];
td [pcdata questions];
];
tr [
td [pcdata "Voters?"];
td [pcdata voters];
......
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