functor Make(M : Conference.INPUT) = struct open M table bid : {User : userId, Paper : paperId, Interest : char} PRIMARY KEY (User, Paper) table assignment : {User : userId, Paper : paperId} PRIMARY KEY (User, Paper) fun intOut ch = case ch of #"_" => "Maybe" | #"-" => "No" | #"+" => "Yes" | _ => error Bid: Invalid Interest code val linksForChair = let fun assignPapers () = tup <- query (SELECT paper.Id, paper.{{M.paper}}, user.Id, user.Nam, bid.Interest, assignment.User FROM paper JOIN bid ON bid.Paper = paper.Id JOIN user ON bid.User = user.Id LEFT JOIN assignment ON assignment.Paper = paper.Id AND assignment.User = user.Id ORDER BY paper.Id, bid.Interest, user.Nam) (fn r (paper, int, acc, ints, papers) => if (case paper of None => False | Some r' => r'.Id = r.Paper.Id) then if int = r.Bid.Interest then return (paper, int, (r.User.Id, r.User.Nam, Option.isSome r.Assignment.User) :: acc, ints, papers) else return (paper, r.Bid.Interest, (r.User.Id, r.User.Nam, Option.isSome r.Assignment.User) :: [], (int, acc) :: ints, papers) else return (Some r.Paper, r.Bid.Interest, (r.User.Id, r.User.Nam, Option.isSome r.Assignment.User) :: [], [], case paper of None => papers | Some r => (r.Id, r -- #Id, (int, acc) :: ints) :: papers)) (None, #" ", [], [], []); let val papersL = case tup.1 of Some r => (r.Id, r -- #Id, (tup.2, tup.3) :: tup.4) :: tup.5 | None => [] fun makePapers () = List.mapM (fn (pid, extra, ints) => ints <- List.mapM (fn (int, users) => cg <- CheckGroup.create (List.mp (fn (id, nam, sel) => (id, txt nam, sel)) users); ex <- Expandable.create (CheckGroup.render cg); return (int, cg, ex)) ints; return (pid, extra, ints)) papersL fun saveAssignment ls = dml (DELETE FROM assignment WHERE TRUE); List.app (fn (pid, uids) => List.app (fn uid => dml (INSERT INTO assignment (Paper, User) VALUES ({[pid]}, {[uid]}))) uids) ls in papers <- source []; return

Assign papers


#{[pid]}: {summarizePaper extra}: this <- CheckGroup.selected cg; total <- total; return (List.length this + total)) (return 0) ints; return (txt n)}/>
{List.mapX (fn (int, _, ex) => {[intOut int]}: {Expandable.render ex} ) ints}
) papers)}/>