Skip to content

Commit 5e98e2d

Browse files
committed
improve text
1 parent cfbe2f2 commit 5e98e2d

4 files changed

Lines changed: 25 additions & 7 deletions

File tree

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
.PHONY: test
2-
test:
2+
test: test-go test-js
3+
4+
.PHONY: test-go
5+
test-go:
36
go test -race -cover ./...
47

8+
.PHONY: test-js
9+
test-js:
10+
@echo "Running JavaScript tests..."
11+
@node internal/server/static/formatR2RCallout.test.js
12+
513
# BEGIN: lint-install .
614
# http://github.com/codeGROOVE-dev/lint-install
715

internal/server/server.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,9 +2348,8 @@ func (s *Server) processOrgSampleWithProgress(ctx context.Context, req *OrgSampl
23482348
// processPRsInParallel processes PRs in parallel and sends progress updates via SSE.
23492349
//
23502350
//nolint:revive // line-length/use-waitgroup-go: long function signature acceptable, standard wg pattern
2351-
func (s *Server) processPRsInParallel(workCtx, reqCtx context.Context, samples []github.PRSummary, defaultOwner, defaultRepo, token string, cfg cost.Config, writer http.ResponseWriter) ([]cost.Breakdown, map[string]int) {
2352-
var breakdowns []cost.Breakdown
2353-
aggregatedSeconds := make(map[string]int)
2351+
func (s *Server) processPRsInParallel(workCtx, reqCtx context.Context, samples []github.PRSummary, defaultOwner, defaultRepo, token string, cfg cost.Config, writer http.ResponseWriter) (breakdowns []cost.Breakdown, aggregatedSeconds map[string]int) {
2352+
aggregatedSeconds = make(map[string]int)
23542353
var mu sync.Mutex
23552354
var sseMu sync.Mutex // Protects SSE writes to prevent corrupted chunked encoding
23562355

internal/server/static/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,9 +1480,9 @@ <h3>Why calculate PR costs?</h3>
14801480
}
14811481

14821482
let html = '<div style="margin: 24px 0; padding: 12px 20px; background: linear-gradient(135deg, #e6f9f0 0%, #ffffff 100%); border: 1px solid #00c853; border-radius: 8px; font-size: 14px; color: #1d1d1f; line-height: 1.6;">';
1483-
html += '✓ You\'re losing <strong>' + savingsText + '/yr</strong>' + throughputText + ' to code review lag. ';
1484-
html += '<a href="https://codegroove.dev/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready-to-Review</a> fixes it: <strong>&lt;40min merges</strong>, free for OSS. ';
1485-
html += '<a href="mailto:go-faster@codeGROOVE.dev" style="color: #00c853; text-decoration: none;">go-faster@codeGROOVE.dev</a>';
1483+
html += 'Pro-Tip: Save <strong>' + savingsText + '/yr</strong> in lost development effort by reducing merge times to &lt;1h with ';
1484+
html += '<a href="https://codegroove.dev/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready-to-Review</a>. ';
1485+
html += 'Free for OSS, cheap for everyone else.';
14861486
html += '</div>';
14871487
return html;
14881488
}

pkg/cost/cost_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ func TestCalculateWithRealPRData(t *testing.T) {
187187
} `json:"events"`
188188
PullRequest struct {
189189
CreatedAt string `json:"created_at"`
190+
ClosedAt string `json:"closed_at"`
191+
MergedAt string `json:"merged_at"`
190192
Author string `json:"author"`
191193
Additions int `json:"additions"`
192194
AuthorWriteAccess int `json:"author_write_access"`
@@ -219,11 +221,20 @@ func TestCalculateWithRealPRData(t *testing.T) {
219221
t.Fatalf("Failed to parse created_at: %v", err)
220222
}
221223

224+
var closedAt time.Time
225+
if prxData.PullRequest.ClosedAt != "" {
226+
closedAt, err = time.Parse(time.RFC3339, prxData.PullRequest.ClosedAt)
227+
if err != nil {
228+
t.Fatalf("Failed to parse closed_at: %v", err)
229+
}
230+
}
231+
222232
prData := PRData{
223233
LinesAdded: prxData.PullRequest.Additions,
224234
Author: prxData.PullRequest.Author,
225235
Events: events,
226236
CreatedAt: createdAt,
237+
ClosedAt: closedAt,
227238
}
228239

229240
cfg := DefaultConfig()

0 commit comments

Comments
 (0)