Include slot claimers in the Going list
The Going section now shows both RSVPs and people who claimed slots, deduplicated by name (case-insensitive). Claim-only people don't get a remove button—they unclaim from the slot card instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+22
@@ -121,10 +121,17 @@ type SlotView struct {
|
|||||||
Pct int64
|
Pct int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GoingPerson struct {
|
||||||
|
Name string
|
||||||
|
Note string
|
||||||
|
RsvpID int64
|
||||||
|
}
|
||||||
|
|
||||||
type EventPageData struct {
|
type EventPageData struct {
|
||||||
Event db.Event
|
Event db.Event
|
||||||
Slots []SlotView
|
Slots []SlotView
|
||||||
Rsvps []db.Rsvp
|
Rsvps []db.Rsvp
|
||||||
|
GoingList []GoingPerson
|
||||||
TotalGoing int64
|
TotalGoing int64
|
||||||
IsAdmin bool
|
IsAdmin bool
|
||||||
BaseURL string
|
BaseURL string
|
||||||
@@ -180,6 +187,20 @@ func (s *Server) loadEventPage(r *http.Request, slug string, isAdmin bool) (*Eve
|
|||||||
}
|
}
|
||||||
totalGoing += int64(len(rsvps))
|
totalGoing += int64(len(rsvps))
|
||||||
|
|
||||||
|
// Build deduplicated GoingList: RSVPs first, then claim-only people
|
||||||
|
var goingList []GoingPerson
|
||||||
|
seen := make(map[string]bool)
|
||||||
|
for _, r := range rsvps {
|
||||||
|
goingList = append(goingList, GoingPerson{Name: r.Name, Note: r.Note, RsvpID: r.ID})
|
||||||
|
seen[strings.ToLower(r.Name)] = true
|
||||||
|
}
|
||||||
|
for _, c := range claims {
|
||||||
|
if !seen[strings.ToLower(c.Name)] {
|
||||||
|
goingList = append(goingList, GoingPerson{Name: c.Name})
|
||||||
|
seen[strings.ToLower(c.Name)] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var descHTML template.HTML
|
var descHTML template.HTML
|
||||||
if event.Description != "" {
|
if event.Description != "" {
|
||||||
descHTML = RenderMarkdown(event.Description)
|
descHTML = RenderMarkdown(event.Description)
|
||||||
@@ -189,6 +210,7 @@ func (s *Server) loadEventPage(r *http.Request, slug string, isAdmin bool) (*Eve
|
|||||||
Event: event,
|
Event: event,
|
||||||
Slots: slotViews,
|
Slots: slotViews,
|
||||||
Rsvps: rsvps,
|
Rsvps: rsvps,
|
||||||
|
GoingList: goingList,
|
||||||
TotalGoing: totalGoing,
|
TotalGoing: totalGoing,
|
||||||
IsAdmin: isAdmin,
|
IsAdmin: isAdmin,
|
||||||
BaseURL: s.baseURL,
|
BaseURL: s.baseURL,
|
||||||
|
|||||||
@@ -32,17 +32,19 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section-label">Going ({{len .Rsvps}})</div>
|
<div class="section-label">Going ({{.TotalGoing}})</div>
|
||||||
<div class="rsvp-list">
|
<div class="rsvp-list">
|
||||||
{{if .Rsvps}}
|
{{if .GoingList}}
|
||||||
{{range .Rsvps}}
|
{{range .GoingList}}
|
||||||
<span class="claim-chip">
|
<span class="claim-chip">
|
||||||
{{.Name}}{{if .Note}} <small style="color:#888">({{.Note}})</small>{{end}}
|
{{.Name}}{{if .Note}} <small style="color:#888">({{.Note}})</small>{{end}}
|
||||||
<button hx-delete="/e/{{$.Event.Slug}}/rsvp/{{.ID}}"
|
{{if gt .RsvpID 0}}
|
||||||
|
<button hx-delete="/e/{{$.Event.Slug}}/rsvp/{{.RsvpID}}"
|
||||||
hx-target="#slots-container"
|
hx-target="#slots-container"
|
||||||
hx-swap="innerHTML settle:0.1s"
|
hx-swap="innerHTML settle:0.1s"
|
||||||
hx-confirm="Remove {{.Name}}?"
|
hx-confirm="Remove {{.Name}}?"
|
||||||
title="Remove">×</button>
|
title="Remove">×</button>
|
||||||
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|||||||
Reference in New Issue
Block a user