|
|
|
@ -60,15 +60,12 @@ func set_poll(__poll:MajorityJudgmentPoll):
|
|
|
|
|
poll = __poll
|
|
|
|
|
craft_nodes()
|
|
|
|
|
update_scene()
|
|
|
|
|
App.save_ongoing_poll()
|
|
|
|
|
|
|
|
|
|
self.providers = App.get_providers()
|
|
|
|
|
for provider in self.providers:
|
|
|
|
|
start_provider(provider)
|
|
|
|
|
|
|
|
|
|
# var provider = MajorityJudgmentDemoProvider.new()
|
|
|
|
|
# var provider = MajorityJudgmentTwitchChatProvider.new()
|
|
|
|
|
# start_provider(provider)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func close_poll():
|
|
|
|
|
App.close_ongoing_poll()
|
|
|
|
@ -236,6 +233,8 @@ func get_or_create_participant(identifier:String) -> MajorityJudgmentParticipant
|
|
|
|
|
return known_participants[identifier]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var __save_mutex := Mutex.new() # perhaps overzealous
|
|
|
|
|
|
|
|
|
|
func __on_judgment_emitted(author_identifier, grade_index, candidate_index):
|
|
|
|
|
# Data comes from userland, best be careful here
|
|
|
|
|
if (
|
|
|
|
@ -253,12 +252,16 @@ func __on_judgment_emitted(author_identifier, grade_index, candidate_index):
|
|
|
|
|
# printerr("Ignoring candidate %s since it's out of range." % [char(candidate_index)])
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
__save_mutex.lock()
|
|
|
|
|
var j = MajorityJudgmentJudgment.new()
|
|
|
|
|
j.set_participant(get_or_create_participant(author_identifier))
|
|
|
|
|
j.set_grade(poll.grading.grades[grade_index])
|
|
|
|
|
j.set_candidate(poll.candidates[candidate_index])
|
|
|
|
|
poll.add_judgment(j)
|
|
|
|
|
|
|
|
|
|
App.save_ongoing_poll()
|
|
|
|
|
__save_mutex.unlock()
|
|
|
|
|
|
|
|
|
|
update_scene()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|