Skip to content

Commit

Permalink
fix register counting bug
Browse files Browse the repository at this point in the history
A lemma doesn't exists, only because the author end on "."
  • Loading branch information
the-it committed Nov 18, 2022
1 parent fea17c5 commit de04d6d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
7 changes: 0 additions & 7 deletions service/ws_re/integration_test/test_integration.py
Expand Up @@ -153,10 +153,3 @@ def test_compare_lemma(self): # pragma: no cover
if char != lemma_2[i]:
raise AssertionError(f"position {i} {char}({ord(char)}) "
f"!= {lemma_2[i]}({ord(lemma_2[i])})")

def test_lemma_exists(self): # pragma: no cover
registers = Registers()
for register_str, register in registers.volumes.items():
for lemma in register.lemmas:
if lemma.chapters[0].author and lemma.chapters[0].author.endswith("."):
print(register_str, lemma, lemma.chapters[0].author)
4 changes: 0 additions & 4 deletions service/ws_re/register/lemma.py
Expand Up @@ -350,10 +350,6 @@ def update_lemma_dict(self, update_dict: LemmaDict, remove_items: List[str] = No

@property
def exists(self) -> bool:
if chapters := self._chapters:
if author := chapters[0].author:
if author.endswith("."):
return True
if self["proof_read"]:
if self._lemma_dict["proof_read"] > 1:
return True
Expand Down
12 changes: 6 additions & 6 deletions service/ws_re/register/test_data/test_lemma_exists.yml
@@ -1,21 +1,21 @@
basic:
no_proof_read:
given:
lemma: Lemma
proof_read: 4
chapters:
- author: Someone.
- author: Someone
start: 10
expect: true
expect: false

basic_false:
proof_read_too_low:
given:
lemma: Lemma
proof_read: 1
chapters:
- author: Someone
start: 10
expect: false

has_only_proof_read:
proof_read:
given:
lemma: Lemma
proof_read: 4
Expand Down

0 comments on commit de04d6d

Please sign in to comment.