From 54c536e68ca1a1370a98a8836a2d83dcf6b4ab20 Mon Sep 17 00:00:00 2001 From: LukeItUp Date: Thu, 23 Jul 2020 13:52:45 +0200 Subject: [PATCH] Fix for multiword examples --- .gitignore | 1 + src/message/ske_messages.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a67997d..4ad8b37 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,6 @@ build/* # using kdev4, works fairly nicely! .kdev4 **/*.kdev4 +remote diff --git a/src/message/ske_messages.py b/src/message/ske_messages.py index 0f7a200..5777f63 100644 --- a/src/message/ske_messages.py +++ b/src/message/ske_messages.py @@ -26,6 +26,7 @@ class SkeExample: self.mid = "" self.s_id = "" self.gf2_good = None + self.gf2_check = False @staticmethod def fromLine(line): @@ -140,7 +141,7 @@ class SkeModal(ClickMessage): elif type(data) is list: window.console.log(data) # check if gf2 examples are loaded or not - if data[0].gf2_good is None: + if not data[0].gf2_check: # we get the data, we have to match it with available data on our gf2 examples API match_gf2_examples(data, page_num, search_term, ske_index) @@ -161,12 +162,18 @@ class SkeModalGf2Update(SkeModal): example.gf_good = False data_dict[example.s_id] = example + bad_response = dict(response_data["bad"]) + for gf_sid, gf_data in bad_response.items(): + data_dict[gf_sid].gf2_good = None + data_dict[gf_sid].gf2_check = True + good_response = dict(response_data["good"]) for gf_sid, gf_data in good_response.items(): data_dict[gf_sid].left = gf_data.left data_dict[gf_sid].mid = gf_data.mid data_dict[gf_sid].right = gf_data.right data_dict[gf_sid].gf2_good = True + data_dict[gf_sid].gf2_check = True # changed data_dict, now we can redraw! # just let it do its thing in update_model @@ -216,6 +223,8 @@ class SkeInsert(DataChgClickMessage): else: console.log("You really should not be here, my lady") continue + + model.reset() def _as_corpus_example(self, example): new_example = Example()