mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-20 21:25:23 +08:00
using Instant Run-off Voting algorithm to Poll Plugin (Part 2 add Ranked Choice) --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com> Co-authored-by: Jarek Radosz <jradosz@gmail.com>
24 lines
500 B
Ruby
Vendored
24 lines
500 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
Fabricator(:poll) do
|
|
post
|
|
name { sequence(:name) { |i| "Poll #{i}" } }
|
|
end
|
|
|
|
Fabricator(:poll_regular, from: :poll) { type "regular" }
|
|
|
|
Fabricator(:poll_multiple, from: :poll) { type "multiple" }
|
|
|
|
Fabricator(:poll_ranked_choice, from: :poll) { type "ranked_choice" }
|
|
|
|
Fabricator(:poll_option) do
|
|
poll
|
|
html { sequence(:html) { |i| "Poll Option #{i}" } }
|
|
digest { sequence(:digest) { |i| "#{i}" } }
|
|
end
|
|
|
|
Fabricator(:poll_vote) do
|
|
poll
|
|
poll_option
|
|
user
|
|
end
|