Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
fix: Fixes the thread sorting algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm committed Dec 21, 2023
1 parent ca20609 commit 778879a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,14 @@ def arrange_in_threads(comments: List[Dict[str, Any]]) -> List[List[int]]:
_thread = [_id]
unused_nodes.remove(_id)
while isinstance(next_map.get(_thread[-1]), int):
_thread.append(next_map[_thread[-1]])
unused_nodes.remove(next_map[_thread[-1]])
_thread.append(next_map[_thread[-1]])
while isinstance(prev_map.get(_thread[0]), int):
_thread.insert(0, prev_map[_thread[0]])
unused_nodes.remove(prev_map[_thread[0]])
_thread.insert(0, prev_map[_thread[0]])
threads.append(_thread)

# Sort threads by the ID of the first comment
return sorted(threads, key=itemgetter(0))

def fetch_pull_comments_from_repo(
Expand Down

0 comments on commit 778879a

Please sign in to comment.