fix(game): show game name in dropdown labels (#43)
search_label built its label from sort_name, an optional sort key that is blank for most games, so the Game and Related-game dropdowns in the add-purchase form (and the session form and search API, which share the property) showed a blank/"None" label. Use name, which is required. Also route search_label and Purchase.full_name through label_with_details so a missing year_released drops out of the parenthetical instead of rendering a literal "None". (platform is never None at display time - Game.save() substitutes the "Unspecified" sentinel.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -63,6 +63,21 @@ class AddPurchasePricingTest(TestCase):
|
||||
{self.game_a.id, self.game_b.id},
|
||||
)
|
||||
|
||||
def test_full_name_keeps_parenthesized_detail_shape(self):
|
||||
bundle = Purchase.objects.create(
|
||||
name="Humble Bundle",
|
||||
date_purchased=date(2025, 1, 1),
|
||||
price=30,
|
||||
price_currency="USD",
|
||||
ownership_type=Purchase.DIGITAL,
|
||||
)
|
||||
bundle.games.set([self.game_a, self.game_b])
|
||||
bundle.refresh_from_db()
|
||||
|
||||
full_name = bundle.full_name
|
||||
self.assertTrue(full_name.startswith("Humble Bundle (2 games, "))
|
||||
self.assertTrue(full_name.endswith(")"))
|
||||
|
||||
|
||||
class SplitPurchaseTest(TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user