feat(matching-runs): add per-run aggregate stats and UI display

- Admin list endpoint returns totalSuggestions, assignedCount, aggregatedNotFoundCount per run
- UI: show Total/Matched/Not found columns using fresh aggregates
- Add anchor link Run #ID and wording 'Pairs created in this run'
This commit is contained in:
Radosław Gierwiało
2025-11-30 13:43:05 +01:00
parent a9ad25eb38
commit 621511fccf
3 changed files with 46 additions and 4 deletions

View File

@@ -101,6 +101,7 @@ export default function MatchingRunsSection({ slug }) {
<th className="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Ended</th>
<th className="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Trigger</th>
<th className="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th className="px-3 py-2 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Total</th>
<th className="px-3 py-2 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Matched</th>
<th className="px-3 py-2 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Not found</th>
</tr>
@@ -117,7 +118,7 @@ export default function MatchingRunsSection({ slug }) {
) : (
runs.map((run) => (
<>
<tr key={run.id}>
<tr key={run.id} id={`run-${run.id}`}>
<td className="px-3 py-2 text-sm text-gray-700">
<button
onClick={() => toggleViewPairs(run.id)}
@@ -139,13 +140,17 @@ export default function MatchingRunsSection({ slug }) {
{run.status}
</span>
</td>
<td className="px-3 py-2 text-sm text-right text-gray-700">{run.matchedCount}</td>
<td className="px-3 py-2 text-sm text-right text-gray-700">{run.notFoundCount}</td>
<td className="px-3 py-2 text-sm text-right text-gray-700">{run.totalSuggestions ?? '-'}</td>
<td className="px-3 py-2 text-sm text-right text-gray-700">{run.assignedCount ?? run.matchedCount}</td>
<td className="px-3 py-2 text-sm text-right text-gray-700">{run.aggregatedNotFoundCount ?? run.notFoundCount}</td>
</tr>
{expandedRunId === run.id && (
<tr>
<td colSpan="7" className="px-3 py-2 bg-gray-50">
<div className="text-sm text-gray-800 font-medium mb-2">Pairs created in this run</div>
<div className="flex items-center justify-between mb-2">
<div className="text-sm text-gray-800 font-medium">Pairs created in this run</div>
<a href={`#run-${run.id}`} className="text-xs text-primary-600 hover:underline">Run #{run.id}</a>
</div>
{pairsLoading && (!pairsByRun[run.id] || pairsByRun[run.id].length === 0) ? (
<div className="text-gray-500">Loading pairs...</div>
) : (pairsByRun[run.id] && pairsByRun[run.id].length > 0 ? (