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

Assign papers

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