fix(campaigns): filter existing-test picker to draft + not in any campaign
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Backend: add not_in_any_campaign filter to list_tests (subquery on CampaignTest) and expose it as a query param on GET /tests. Frontend: the 'Existing Test' tab now requests only state=draft & not_in_any_campaign=true so tests already linked to any campaign or not in draft state are never shown. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,7 @@ export default function AddTestToCampaignModal({
|
||||
|
||||
const { data: allTests, isLoading: testsLoading } = useQuery({
|
||||
queryKey: ["tests", "for-campaign-picker"],
|
||||
queryFn: () => getTests({ limit: 200 }),
|
||||
queryFn: () => getTests({ state: "draft", not_in_any_campaign: true, limit: 200 }),
|
||||
enabled: open && tab === "existing",
|
||||
});
|
||||
|
||||
@@ -506,7 +506,7 @@ export default function AddTestToCampaignModal({
|
||||
<p className="text-sm">
|
||||
{existingSearch
|
||||
? "No tests match your search."
|
||||
: "No available tests to add."}
|
||||
: "No draft tests available. All existing tests are already in a campaign."}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user