changeset: 489:368dc1bbf5f55d4c6d2168fba37f0f1dc20747c9 tag: tip user: David MENTRE date: Sun Mar 25 16:07:14 2007 +0200 files: gtk2-clnt/tags.ml.nw srv/voting.ml.nw description: [bug fix][gtk2 client] Don't break in case of duplicated label in tag's hierarchy In case the same level appears twice (e.g. tags "fa: A" and "fa: B"), hierarchy building was raising an exception. We now handle correctly this case, putting a warning on stderr. diff -r 1560469c9ee79c48c88c39fcf57eee43582aa07f -r 368dc1bbf5f55d4c6d2168fba37f0f1dc20747c9 gtk2-clnt/tags.ml.nw --- a/gtk2-clnt/tags.ml.nw Fri Oct 27 22:13:11 2006 +0200 +++ b/gtk2-clnt/tags.ml.nw Sun Mar 25 16:07:14 2007 +0200 @@ -94,7 +94,12 @@ let rec insert_into_hierarchy hierarchy_ insert_into_hierarchy node_children (lvl_tail, id, label) in [Tag_node(node_lvl, new_node_children, node_id, node_label)] @ other_level - | _ -> assert(false) + | Tag_node(node_lvl, node_children, node_id, node_label) :: tl -> + Printf.eprintf "WARNING: duplicate hierachy for tag:%d\n" id; + let new_node_children = + insert_into_hierarchy node_children (lvl_tail, id, label) in + [Tag_node(node_lvl, new_node_children, node_id, node_label)] + @ tl @ other_level @ Function [[tree_of_tag_hash]] converts a hash-table of tags indexed by diff -r 1560469c9ee79c48c88c39fcf57eee43582aa07f -r 368dc1bbf5f55d4c6d2168fba37f0f1dc20747c9 srv/voting.ml.nw --- a/srv/voting.ml.nw Fri Oct 27 22:13:11 2006 +0200 +++ b/srv/voting.ml.nw Sun Mar 25 16:07:14 2007 +0200 @@ -115,7 +115,7 @@ The simplest case to consider is when a The simplest case to consider is when a response wins over all responses in a one-to-one match. The [[unambiguous_winner]] code returns, for a given pairwise matrix [[mat]], the number of this winner if it exists, -with a [[majority]], or raise [[Not_found]] otherwise. +with a [[majority]], or raises [[Not_found]] otherwise. \assumption{The matrix [[mat]] given as argument is square. [[majority]]$\geq 1$}