fix: handle the "+" correctly in the new poll form

master
Dominique Merle 4 years ago
parent 3e4e58c672
commit 5a5333ddf8

@ -54,7 +54,6 @@ func append_item_invitation():
func prune_empty_items():
# var items_to_prune = Array()
for item in __get_children_items(get_root()):
if item.get_text(TEXT_COLUMN) == '':
if item.get_next():
@ -63,6 +62,13 @@ func prune_empty_items():
item.free()
func prune_extra_items():
for item in __get_children_items(get_root()):
if item.get_text(TEXT_COLUMN) == invite_text:
if item.get_next():
item.free()
func __on_item_edited():
append_item_invitation()
@ -83,6 +89,8 @@ func __on_item_moved(item, to_item, section):
new_item.set_editable(TEXT_COLUMN, true)
new_item.select(TEXT_COLUMN)
item.free()
prune_extra_items()
append_item_invitation()
ensure_cursor_is_visible()

@ -27,7 +27,9 @@ func collect_poll_from_form(form:Control) -> MajorityJudgmentPoll:
var candidates_tree = form.find_node("CandidatesTree", true, false)
var candidate_item = candidates_tree.get_root().get_children()
while (candidate_item):
poll.add_candidate(MajorityJudgmentCandidate.make(candidate_item.get_text(0)))
var candidate_identifier = candidate_item.get_text(candidates_tree.TEXT_COLUMN)
if candidate_identifier != candidates_tree.invite_text:
poll.add_candidate(MajorityJudgmentCandidate.make(candidate_identifier))
candidate_item = candidate_item.get_next()
poll.set_grading(MajorityJudgmentGrading.make_quality_6())

Loading…
Cancel
Save