diff options
Diffstat (limited to 'desk/sur/polls.hoon')
-rw-r--r-- | desk/sur/polls.hoon | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/desk/sur/polls.hoon b/desk/sur/polls.hoon new file mode 100644 index 0000000..93085c2 --- /dev/null +++ b/desk/sur/polls.hoon @@ -0,0 +1,57 @@ +/- gate=trill-gate +|% ++$ pid [ship=@p id=@da] ++$ id @da ++$ expiry @da ++$ text @t ++$ poll +$: author=ship + =time + =expiry + =text + options=(list @t) + =votes + read=lock:gate + write=lock:gate +== ++$ votes +$% excl + incl +== ++$ excl [%exc p=(map ship @ud)] ++$ incl [%inc p=(map @ud (map @p (set @ud)))] +:: some helpers + +++ new-poll +|= [=pid =text =expiry options=(list @t) inc=?] +=/ votes ?. inc *excl *incl +^- poll +:* author=-.pid + time=+.pid + expiry + text + options + votes + read=*lock:gate + write=*lock:gate +== +:: comms ++$ ui-action +$% [%propose text=@t =expiry options=(list @t) exc=?] + [%cancel =id] + [%change-expiry =id =expiry] + [%vote =pid option=@ comment=@t] + [%cancel-vote =pid] +== ++$ update +$% [%new-poll =poll] + [%ded-poll p=pid] + [%old-poll p=poll q=upd] +== ++$ upd +$? [%new-vote p=@ud] + [%expiry-changed q=expiry] + [%vote-changed p=@p old=@ new=@] + [%vote-canceled p=@p q=@] +== +-- |