fix(members): link sponsors to bills and fix member search
- Poller now fetches bill detail on insert to get sponsor (list endpoint has no sponsor data) - Add backfill_sponsor_ids task + admin endpoint + UI button to fix the 1,616 existing bills with NULL sponsor_id - Member name search now matches both "Last, First" and "First Last" using split_part() on the stored name column; same fix applied to global search - Load Bill.sponsor relationship eagerly in get_member_bills to prevent MissingGreenlet error during Pydantic serialization - Remove .trim() on search onChange so spaces can be typed Authored-By: Jack Levy
This commit is contained in:
@@ -45,7 +45,7 @@ export default function BillsPage() {
|
||||
type="text"
|
||||
placeholder="Search bills..."
|
||||
value={q}
|
||||
onChange={(e) => { setQ(e.target.value.trim()); setPage(1); }}
|
||||
onChange={(e) => { setQ(e.target.value); setPage(1); }}
|
||||
className="w-full pl-9 pr-3 py-2 text-sm bg-card border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-primary"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function MembersPage() {
|
||||
type="text"
|
||||
placeholder="Search by name..."
|
||||
value={q}
|
||||
onChange={(e) => { setQ(e.target.value.trim()); setPage(1); }}
|
||||
onChange={(e) => { setQ(e.target.value); setPage(1); }}
|
||||
className="w-full pl-9 pr-3 py-2 text-sm bg-card border border-border rounded-md focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -346,6 +346,12 @@ export default function SettingsPage() {
|
||||
>
|
||||
<RefreshCw className="w-3.5 h-3.5" /> Calculate Trends
|
||||
</button>
|
||||
<button
|
||||
onClick={() => trigger("sponsors", adminAPI.backfillSponsors)}
|
||||
className="flex items-center gap-2 px-4 py-2 text-sm bg-muted hover:bg-accent rounded-md transition-colors"
|
||||
>
|
||||
<RefreshCw className="w-3.5 h-3.5" /> Backfill Sponsors
|
||||
</button>
|
||||
</div>
|
||||
{Object.entries(taskIds).map(([name, id]) => (
|
||||
<p key={name} className="text-xs text-muted-foreground">{name}: task {id} queued</p>
|
||||
|
||||
@@ -151,6 +151,8 @@ export const adminAPI = {
|
||||
apiClient.post("/api/admin/trigger-member-sync").then((r) => r.data),
|
||||
triggerTrendScores: () =>
|
||||
apiClient.post("/api/admin/trigger-trend-scores").then((r) => r.data),
|
||||
backfillSponsors: () =>
|
||||
apiClient.post("/api/admin/backfill-sponsors").then((r) => r.data),
|
||||
getTaskStatus: (taskId: string) =>
|
||||
apiClient.get(`/api/admin/task-status/${taskId}`).then((r) => r.data),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user