Mark unfrozen Supply archive posts and open them in the Supply run
CI / ci (push) Successful in 8m9s
CI / ci (pull_request) Successful in 8m7s

The Supply archive presented every post as a frozen, read-only list, even a
past week's Supply run that week_rollover had not frozen and that the
Supply run route could still change. Each archive post now carries frozen;
a post not yet frozen is marked (Current, or Still open for a past week)
and links to the Supply run, where it can still change. Only frozen posts
open read-only in the archive.

Maestro task 29b629aa-1ad9-48a3-be75-0380b645d4fe

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 09:35:55 -04:00
co-authored by Claude Opus 5.5
parent 791b321b71
commit c2a63192a6
8 changed files with 159 additions and 39 deletions
+8 -2
View File
@@ -152,6 +152,11 @@ type Post struct {
Items, OnHand int
// Current is true for the household's current week.
Current bool
// Frozen is true once the list is frozen into the Supply archive and
// can no longer change. A list not yet frozen — the current week's, or
// a past week's that week_rollover has not frozen — can still be
// changed from the Supply run.
Frozen bool
}
// Archive returns the Supply archive: the Supply run of every week up to
@@ -208,7 +213,7 @@ func (s *Service) Archive(ctx context.Context, by string) (out []Period, err err
if err != nil {
return nil, err
}
p, err := postOf(monday, l, monday == thisWeek)
p, err := postOf(monday, l, monday == thisWeek, frozen(row))
if err != nil {
return nil, err
}
@@ -223,7 +228,7 @@ func (s *Service) Archive(ctx context.Context, by string) (out []Period, err err
// postOf is l, the Supply run of the week starting monday, as a post in
// the Supply archive.
func postOf(monday store.LocalDate, l List, current bool) (Post, error) {
func postOf(monday store.LocalDate, l List, current, isFrozen bool) (Post, error) {
label, err := household.WeekLabel(monday)
if err != nil {
return Post{}, fmt.Errorf("shopping: Supply run %s: %w", l.ID, err)
@@ -241,5 +246,6 @@ func postOf(monday store.LocalDate, l List, current bool) (Post, error) {
Items: c.Total,
OnHand: c.Total - c.Needed,
Current: current,
Frozen: isFrozen,
}, nil
}