fix: review feedback — drop inflated X-Total-Count for PRs, remove redundant curl, use textContent
- Remove X-Total-Count header override for prs_merged_total: header counts all closed PRs (including unmerged/rejected), inflating the dashboard metric. Keep the jq-filtered count from the 50-item page instead. - Remove redundant first curl in backlog_count that discards its response. - Use textContent/createElement instead of innerHTML for project names. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
115063f4ce
commit
874095b689
2 changed files with 5 additions and 13 deletions
|
|
@ -66,14 +66,6 @@ collect_project_metrics() {
|
|||
jq --arg since "$MONTH_AGO" '[.[] | select(.merged and .merged_at >= $since)] | length' 2>/dev/null || echo 0)
|
||||
fi
|
||||
|
||||
# Use the X-Total-Count header for total merged count
|
||||
local total_header
|
||||
total_header=$(curl -sf -I -H "Authorization: token ${CODEBERG_TOKEN}" \
|
||||
"${api_base}/pulls?state=closed&limit=1" 2>/dev/null | grep -i 'x-total-count' | tr -d '\r' | awk '{print $2}' || echo "")
|
||||
if [ -n "$total_header" ]; then
|
||||
prs_merged_total="$total_header"
|
||||
fi
|
||||
|
||||
# Issues closed
|
||||
local issues_closed_week=0 issues_closed_month=0
|
||||
local closed_issues
|
||||
|
|
@ -96,10 +88,7 @@ collect_project_metrics() {
|
|||
|
||||
# Open issues by label
|
||||
local backlog_count in_progress_count blocked_count
|
||||
backlog_count=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \
|
||||
"${api_base}/issues?state=open&labels=backlog&type=issues&limit=1" -o /dev/null \
|
||||
-w '' 2>/dev/null; \
|
||||
curl -sf -I -H "Authorization: token ${CODEBERG_TOKEN}" \
|
||||
backlog_count=$(curl -sf -I -H "Authorization: token ${CODEBERG_TOKEN}" \
|
||||
"${api_base}/issues?state=open&labels=backlog&type=issues&limit=1" 2>/dev/null | \
|
||||
grep -i 'x-total-count' | tr -d '\r' | awk '{print $2}' || echo "0")
|
||||
in_progress_count=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \
|
||||
|
|
|
|||
|
|
@ -420,7 +420,10 @@
|
|||
data.projects.forEach(function (p) {
|
||||
var card = el('div', 'project');
|
||||
var nameDiv = el('div', 'name');
|
||||
nameDiv.innerHTML = '<a href="https://codeberg.org/' + p.repo + '">' + p.name + '</a>';
|
||||
var nameLink = document.createElement('a');
|
||||
nameLink.href = 'https://codeberg.org/' + p.repo;
|
||||
nameLink.textContent = p.name;
|
||||
nameDiv.appendChild(nameLink);
|
||||
card.appendChild(nameDiv);
|
||||
|
||||
var metricsDiv = el('div', 'metrics');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue