Skip to content

Commit

Permalink
fix(matcher): clean highlight and debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonestla committed Sep 9, 2024
1 parent 1e4b414 commit 7c88ff1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions project/server/main/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ def clean_highlights(highlights: dict):
for criteria in highlights[strategy][match_id]:
if criteria not in new_highlights[match_id]["criterion"]:
new_highlights[match_id]["criterion"][criteria] = []
for highlight in highlights[strategy][match_id][criteria]:
logger.debug(f"highlight: {highlight}")
new_highlights[match_id]["criterion"][criteria] = [
tag.text for tag in BeautifulSoup(highlight[0], "lxml").find_all("em")
]
for highlight in highlights[strategy][match_id][criteria]:
logger.debug(f"highlight: {highlight}")
new_highlights[match_id]["criterion"][criteria].append(
[tag.text for tag in BeautifulSoup(highlight[0], "lxml").find_all("em")]
)
return new_highlights


Expand Down Expand Up @@ -271,9 +271,9 @@ def match(self, method: str = None, conditions: dict = None, strategies: list =
logs += f'Strategy : {strategy} : {len(strategy_results)} matches <br/>'
logs += f'Equivalent strategies have {len(equivalent_strategies_results)} possibilities that match ' \
f'one of the strategy<br/>'
debug["strategies"].append(
{"equivalent_strategies": equivalent_strategies, "matches": len(equivalent_strategies_results)}
)
debug["strategies"].append(
{"equivalent_strategies": equivalent_strategies, "matches": len(equivalent_strategies_results)}
)
# Strategies stopped as soon as a first result is met for an equivalent_strategies
all_highlights = {}
if len(equivalent_strategies_results) > 0:
Expand Down

0 comments on commit 7c88ff1

Please sign in to comment.