|
|
|
@ -60,14 +60,11 @@ 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():
|
|
|
|
@ -234,7 +231,9 @@ func get_or_create_participant(identifier:String) -> MajorityJudgmentParticipant
|
|
|
|
|
if not known_participants.has(identifier):
|
|
|
|
|
known_participants[identifier] = MajorityJudgmentParticipant.make(identifier)
|
|
|
|
|
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
|
|
|
|
@ -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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|