Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 9f314163 authored by Stephane Glondu's avatar Stephane Glondu

Pretty message on pretty_ballots for archived elections

parent 56e8028a
......@@ -1182,8 +1182,9 @@ let () =
let module W = Web_election.Make ((val w)) (LwtRandom) in
let module B = W.B in
let module W = W.D in
lwt res = B.Ballots.fold (fun h _ accu -> return (h :: accu)) [] in
T.pretty_ballots (module W) res () >>= Html5.send)
lwt ballots = B.Ballots.fold (fun h _ accu -> return (h :: accu)) [] in
lwt result = Web_persist.get_election_result uuid_s in
T.pretty_ballots (module W) ballots result () >>= Html5.send)
let () =
Any.register
......
......@@ -1362,7 +1362,7 @@ let cast_confirmed w ~result () =
let uuid = params.e_uuid in
base ~title:name ~login_box ~content ~uuid ()
let pretty_ballots w hashes () =
let pretty_ballots w hashes result () =
let module W = (val w : WEB_ELECTION_DATA) in
let params = W.election.e_params in
let title = params.e_name ^ " — Accepted ballots" in
......@@ -1388,10 +1388,34 @@ let pretty_ballots w hashes () =
[pcdata "Back to election"]
(params.e_uuid, ())]
in
let number = div [
pcdata (string_of_int !nballots);
pcdata " ballot(s) have been accepted so far."
] in
let number = match !nballots, result with
| 0, Some r ->
div [
pcdata (string_of_int r.num_tallied);
pcdata " ballot(s) have been accepted.";
pcdata " Ballot details are no longer available for this election,";
pcdata " but you can still download the whole ";
a ~service:(file w ESBallots) [pcdata "ballot list"] ();
pcdata ".";
]
| n, None ->
div [
pcdata (string_of_int n);
pcdata " ballot(s) have been accepted so far."
]
| n, Some r when n = r.num_tallied ->
div [
pcdata (string_of_int n);
pcdata " ballot(s) have been accepted."
]
| n, Some r -> (* should not happen *)
div [
pcdata (string_of_int n);
pcdata " ballot(s) have been accepted, and ";
pcdata (string_of_int r.num_tallied);
pcdata " have been tallied.";
]
in
let content = [
number;
ul ballots;
......
......@@ -19,6 +19,7 @@
(* <http://www.gnu.org/licenses/>. *)
(**************************************************************************)
open Serializable_t
open Web_signatures
val home : unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
......@@ -45,7 +46,7 @@ val regenpwd : Uuidm.t -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_raw : (module WEB_ELECTION_DATA) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmation : (module WEB_ELECTION_DATA) -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmed : (module WEB_ELECTION_DATA) -> result:[< `Error of Web_common.error | `Valid of string ] -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val pretty_ballots : (module WEB_ELECTION_DATA) -> string list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val pretty_ballots : (module WEB_ELECTION_DATA) -> string list -> Yojson.Safe.json result option -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val tally_trustees : (module WEB_ELECTION_DATA) -> int -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
......
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