Skip to content

Commit

Permalink
fix: anki tags are not added (#398)
Browse files Browse the repository at this point in the history
fix: anki tags are not added

feat: implement

misc.
  • Loading branch information
MartinBernstorff authored Dec 19, 2023
2 parents 49d0501 + bf36051 commit 5e05ab5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"--host-apkg-dir=/Users/Leisure/",
"--no-dry-run",
"--no-watch",
"--max-deletions-per-run=300",
]
}
]
Expand Down
6 changes: 1 addition & 5 deletions personal_mnemonic_medium/data_access/ankiconnect_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,7 @@ def import_package(self, package: genanki.Package) -> None:


def in_docker() -> bool:
try:
with Path("/proc/1/cgroup").open("r") as ifh:
return "docker" in ifh.read()
except Exception:
return False
return Path("/.dockerenv").exists()


ANKICONNECT_URL = (
Expand Down
4 changes: 3 additions & 1 deletion personal_mnemonic_medium/data_access/test_ankiconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_import_package(self):
genanki.Note(
model=model,
fields=["Capital of Argentina", "Buenos Aires"],
tags=["TestTag"],
)
)

Expand All @@ -74,7 +75,8 @@ def test_import_package(self):

# Phase 2: Getting
all_notes = self.gateway.get_all_note_infos()
assert len(all_notes) == 1
note = all_notes[0]
assert note.tags == ["TestTag"]

# Phase 3: Deleting
self.gateway.delete_notes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ def to_genanki_note(self) -> genanki.Note:
" ".join(self.tags),
str(self.uuid),
],
tags=self.tags,
)
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ def to_genanki_note(self) -> genanki.Note:
" ".join(self.tags),
str(self.uuid),
],
tags=self.tags,
)

0 comments on commit 5e05ab5

Please sign in to comment.