Add a name search box to Add players, explain what "Suggested" means
"Suggested" is whoever was on this team's roster last season -- now spelled out in a caption under the chips (same for "No team"), not just left for a coach to guess at. The search box (?q=, ANDed with whichever filter chip is active) narrows the eligible pool by first/last name, useful once a club's pool of eligible members outgrows a single screenful. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3536,6 +3536,30 @@ class CoachAddPlayerViewTests(TestCase):
|
||||
self.assertEqual(list(candidates), [returning])
|
||||
self.assertNotIn(new_signup, candidates)
|
||||
|
||||
def test_search_matches_first_or_last_name(self):
|
||||
match = self.make_eligible_member(first_name="Zara", last_name="Zenith")
|
||||
other = self.make_eligible_member(first_name="Not", last_name="Matching")
|
||||
self.client.force_login(self.user)
|
||||
|
||||
response = self.client.get(reverse("mobile:coach_add_player") + "?q=zar", HTTP_HOST="ajax-united.rosterchief.app")
|
||||
|
||||
candidates = response.context["candidates"]
|
||||
self.assertIn(match, candidates)
|
||||
self.assertNotIn(other, candidates)
|
||||
|
||||
def test_search_combines_with_the_active_filter(self):
|
||||
previous_season = Season.objects.create(club=self.club, start_date=self.season.start_date - datetime.timedelta(days=365), end_date=self.season.start_date - datetime.timedelta(days=1))
|
||||
returning_match = self.make_eligible_member(first_name="Zara", last_name="Returning")
|
||||
TeamMembership.objects.create(team=self.team, member=returning_match, season=previous_season)
|
||||
returning_no_match = self.make_eligible_member(first_name="Other", last_name="Returning")
|
||||
TeamMembership.objects.create(team=self.team, member=returning_no_match, season=previous_season)
|
||||
self.client.force_login(self.user)
|
||||
|
||||
response = self.client.get(reverse("mobile:coach_add_player") + "?filter=suggested&q=zar", HTTP_HOST="ajax-united.rosterchief.app")
|
||||
|
||||
candidates = response.context["candidates"]
|
||||
self.assertEqual(list(candidates), [returning_match])
|
||||
|
||||
def test_post_adds_selected_members_to_the_roster(self):
|
||||
first = self.make_eligible_member(first_name="First", last_name="Pick")
|
||||
second = self.make_eligible_member(first_name="Second", last_name="Pick")
|
||||
|
||||
Reference in New Issue
Block a user