Skip to content

Commit

Permalink
chore: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
xingwanying committed Jan 21, 2025
1 parent 59b345a commit b7664bc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
30 changes: 17 additions & 13 deletions server/insight/service/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
def get_activity_data(repo_name: str) -> List[Dict[str, int]]:
url = f"https://oss.open-digger.cn/github/{repo_name}/activity_details.json"

response = requests.get(url)
data = response.json()
if not data:
return []
try:
response = requests.get(url)
data = response.json()
if not data:
return []

# Filter out only the monthly data (excluding quarters)
monthly_data = {k: v for k, v in data.items() if "-" in k}
# Filter out only the monthly data (excluding quarters)
monthly_data = {k: v for k, v in data.items() if "-" in k}

# Get the most recent month
most_recent_month_key = max(monthly_data.keys())
# Get the most recent month
most_recent_month_key = max(monthly_data.keys())

# Return the data for the most recent month
return [
{"user": user, "value": value}
for user, value in monthly_data[most_recent_month_key]
]
# Return the data for the most recent month
return [
{"user": user, "value": value}
for user, value in monthly_data[most_recent_month_key]
]
except Exception as e:
print(e)
return []
5 changes: 5 additions & 0 deletions server/utils/insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ def get_data(repo_name, metrics_mapping):
print(
f"Error fetching data from {url} (status code: {response.status_code})"
)
return {
"year": [],
"quarter": [],
"month": [],
}

def format_result(data):
result = []
Expand Down

0 comments on commit b7664bc

Please sign in to comment.