Commit c17f1540 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Remove voting_{starts,ends}_at from metadata

This is not the right location for this data...
parent ace0d41e
......@@ -73,16 +73,7 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) (M : RANDOM with type 'a t = 'a
let do_cast rawballot (user, date) =
lwt state = Web_persist.get_election_state uuid in
let voting_open =
let compare a b =
match a, b with
| Some a, Some b -> datetime_compare a b
| _, _ -> -1
in
state = `Open &&
compare metadata.e_voting_starts_at (Some date) <= 0 &&
compare (Some date) metadata.e_voting_ends_at < 0
in
let voting_open = state = `Open in
if not voting_open then fail ElectionClosed else return () >>
if String.contains rawballot '\n' then (
fail (Serialization (Invalid_argument "multiline ballot"))
......
......@@ -46,8 +46,6 @@ type auth_config = {
}
type metadata = {
?voting_starts_at : datetime option;
?voting_ends_at : datetime option;
?owner: user option;
?auth_config: auth_config list option;
} <ocaml field_prefix="e_">
......
......@@ -326,8 +326,6 @@ let () = Redirection.register ~service:election_setup_new
let uuid_s = Uuidm.to_string uuid in
lwt token = generate_token () in
let se_metadata = {
e_voting_starts_at = None;
e_voting_ends_at = None;
e_owner = Some u;
e_auth_config = Some [{auth_system = "password"; auth_instance = "password"; auth_config = []}];
} in
......
......@@ -741,34 +741,7 @@ let file w x =
let election_home w state () =
let module W = (val w : WEB_ELECTION) in
let params = W.election.e_params and m = W.metadata in
let voting_period =
match m.e_voting_starts_at, m.e_voting_ends_at with
| None, None ->
[
pcdata "This election starts and ends at the administrator's discretion."
]
| Some s, None ->
[
pcdata "This election starts on ";
em [pcdata (format_date s)];
pcdata " and ends at the administrator's discretion.";
]
| None, Some s ->
[
pcdata "This election starts at the administrator's discretion and ends on ";
em [pcdata (format_date s)];
pcdata ".";
]
| Some s, Some e ->
[
pcdata "This election starts on ";
em [pcdata (format_date s)];
pcdata " and ends on ";
em [pcdata (format_date e)];
pcdata ".";
]
in
let params = W.election.e_params in
let state_ =
match state with
| `Closed ->
......@@ -875,7 +848,7 @@ let election_home w state () =
| _ -> go_to_the_booth
in
let content = [
p (voting_period @ state_);
p state_;
br ();
middle;
br ();
......
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