Skip to content

Commit

Permalink
Remove superfluous index field
Browse files Browse the repository at this point in the history
  • Loading branch information
XanderVertegaal committed Jul 4, 2024
1 parent ab6d7de commit 22c3aa6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 2 additions & 6 deletions backend/aethel_db/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def aethel_status():

@dataclass
class AethelSamplePhrase:
index: str
display: str
highlight: bool

Expand Down Expand Up @@ -50,9 +49,7 @@ class AethelListResponse:
results: List[AethelListItem] = field(default_factory=list)
error: Optional[str] = None

def get_or_create_result(
self, lemma: str, word: str, type: str
) -> AethelListItem:
def get_or_create_result(self, lemma: str, word: str, type: str) -> AethelListItem:
"""
Return an existing result with the same lemma, word, and type, or create a new one if it doesn't exist.
"""
Expand Down Expand Up @@ -98,7 +95,6 @@ def serialize_sample(
for index, phrase in enumerate(sample.lexical_phrases):
highlighted = index in highlighted_phrase_indices
new_phrase = AethelSamplePhrase(
index=index,
display=phrase.string,
highlight=highlighted,
)
Expand All @@ -117,7 +113,7 @@ def serialize_sample(
# Then we transform the results.
# Each key in result_dict is a unique combination of lemma, word, and type.
# Each value is a sample, mapped to a set of indices referring to the specific phrase that has the type.
result_dict: dict[tuple[str, str, str], dict[str, set]] = {}
result_dict: dict[tuple[str, str, str], dict[str, set[int]]] = {}
for sample in query_result:
for phrase_index, phrase in enumerate(sample.lexical_phrases):
for item in phrase.items:
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export interface AethelListReturnItem {
samples: {
name: string;
phrases: {
index: string;
display: string;
highlight: boolean;
}[];
Expand Down

0 comments on commit 22c3aa6

Please sign in to comment.