Skip to content

Commit

Permalink
implement refresh feature for 2 section in repo details page
Browse files Browse the repository at this point in the history
  • Loading branch information
JisanAR03 committed Jan 2, 2025
1 parent 39a21f7 commit 712b04f
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions website/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,16 +1008,24 @@ def get_issue_count(full_name, query, headers):

except requests.RequestException as e:
return JsonResponse(
{"status": "error", "message": "Network error: A network error occurred. Please try again later."}, status=503
{
"status": "error",
"message": "Network error: A network error occurred. Please try again later.",
},
status=503,
)
except requests.HTTPError as e:
return JsonResponse(
{"status": "error", "message": "A GitHub API error occurred. Please try again later."},
{
"status": "error",
"message": "A GitHub API error occurred. Please try again later.",
},
status=e.response.status_code,
)
except ValueError as e:
return JsonResponse(
{"status": "error", "message": "There was an error processing your data."}, status=400
{"status": "error", "message": "There was an error processing your data."},
status=400,
)

elif section == "metrics":
Expand Down Expand Up @@ -1127,16 +1135,24 @@ def get_issue_count(full_name, query, headers):

except requests.RequestException as e:
return JsonResponse(
{"status": "error", "message": "Network error: A network error occurred. Please try again later."}, status=503
{
"status": "error",
"message": "Network error: A network error occurred. Please try again later.",
},
status=503,
)
except requests.HTTPError as e:
return JsonResponse(
{"status": "error", "message": "A GitHub API error occurred. Please try again later."},
{
"status": "error",
"message": "A GitHub API error occurred. Please try again later.",
},
status=e.response.status_code,
)
except ValueError as e:
return JsonResponse(
{"status": "error", "message": "There was an error processing your data."}, status=400
{"status": "error", "message": "There was an error processing your data."},
status=400,
)

return super().post(request, *args, **kwargs)

0 comments on commit 712b04f

Please sign in to comment.