coverage~bigbes/sr-ht-doltede3b0bbweb/milestones.go

Coverage
87.5% 7/8 statements
Δ
Blob
567000c
Uncovered L33-L34
1 package web
2
3 import (
4 "context"
5 "net/url"
6
7 "sourcecraft.dev/bigbes/sr-ht-dolt/beads"
8 "sourcecraft.dev/bigbes/sr-ht-dolt/browse"
9 "sourcecraft.dev/bigbes/sr-ht-dolt/core"
10 )
11
12 // milestonesView groups a beads issue DB by its "milestone:<name>" labels and
13 // shows per-milestone progress with the issues under each. It shares the beads
14 // fingerprint, so it appears as a companion tab wherever the Beads view does.
15 // The grouping itself lives in the beads package; this type is the View adapter.
16 type milestonesView struct{}
17
18 48 func (*milestonesView) Name() string { return "milestones" }
19 20 func (*milestonesView) Label() string { return "Milestones" }
20 5 func (*milestonesView) Template() string { return "milestones.html" }
21
22 // Applies mirrors the beads fingerprint so Milestones and Beads pair up. A
23 // beads DB that happens to use no milestone labels still gets the tab; it just
24 // renders an empty state.
25 26 func (*milestonesView) Applies(tables []browse.TableInfo) bool { return beads.Applies(tables) }
26
27 // Build groups the issues by milestone label; the result is a
28 // *beads.MilestoneView, handed to milestones.html as its .Data. The view takes
29 // no query parameters — the board is where filtering happens.
30 5 func (*milestonesView) Build(ctx context.Context, sess BrowseSession, _ *core.Repo, ref string, _ url.Values) (any, error) {
31 5 data, err := beads.BuildMilestones(ctx, sess, ref)
32 5 if err != nil {
33 0 return nil, err
34 0 }
35 5 return data, nil
36 }