Skip to content

Commit

Permalink
Fetch correct code when start line <= 1 (#140)
Browse files Browse the repository at this point in the history
* return existing project id

* update start point for file

* linter
  • Loading branch information
dhirenmathur authored Oct 29, 2024
1 parent b2f34c6 commit 1907136
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/modules/github/github_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def get_file_content(
if (start_line == end_line == 0) or (start_line == end_line == None):
return decoded_content
# added -2 to start and end line to include the function definition/ decorator line
selected_lines = lines[start_line - 2 : end_line]
start = start_line - 2 if start_line - 2 > 0 else 0
selected_lines = lines[start:end_line]
return "\n".join(selected_lines)
except Exception as e:
logger.error(
Expand Down
6 changes: 5 additions & 1 deletion app/modules/parsing/graph_construction/parsing_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ async def parse_directory(
response = {"project_id": project_id, "status": project_status}

# Check commit status
is_latest = await parse_helper.check_commit_status(project_id) if not demo_project else True
is_latest = (
await parse_helper.check_commit_status(project_id)
if not demo_project
else True
)

if not is_latest or project_status != ProjectStatusEnum.READY.value:
cleanup_graph = True
Expand Down

0 comments on commit 1907136

Please sign in to comment.