fix(club): hide only ACTIVELY-LISTED cards, not the whole trade pile
Keying the club exclusion on the `trade` pile put cards in limbo: the pile can hold cards with no active listing (a bare "Place on Transfer Market" move, or a listing later cancelled/sold), and `/tradePile` renders ONLY active listings — so those cards were invisible in BOTH views. Live prod had 5 trade-pile rows but 1 active listing, so 4 owned cards had no reachable screen (clubPlayers 1966->1961). Key on the ACTIVE LISTING instead (market store `core_item_id` of `state=active`). This is self-healing: the moment a listing stops being active the card is back in the club, with no extra transition to maintain and no need to invent an "unlisted transfer-list" wire shape (`tradeState` has no verified spelling for that state, and guessing enum spellings is the documented client-freeze class). A bare pile move therefore no longer hides a card. That is deliberate: our `/tradePile` shows only active listings, so hiding on the move alone would reintroduce the limbo it is meant to prevent. Verified live: clubPlayers 1961 -> 1965 (exactly the one listed card hidden, the 4 stranded cards recovered); listed wire still absent from /club; counts and tradePile unchanged. 14 targets green + clippy clean.
This commit is contained in:
@@ -295,11 +295,11 @@ fn resolver_for(cards: &[(&str, u32)]) -> Arc<Fifa17IdentityResolver> {
|
||||
Arc::new(Fifa17IdentityResolver::new(catalog, Arc::new(store)))
|
||||
}
|
||||
|
||||
/// A card on the transfer list has LEFT the club: `/club` must not show it, and
|
||||
/// A card with an ACTIVE listing has LEFT the club: `/club` must not show it, and
|
||||
/// pagination must run over the CLUB-VISIBLE set (never Core's unfiltered page,
|
||||
/// which would hand back short pages).
|
||||
#[test]
|
||||
fn club_excludes_transfer_pile_items_and_paginates_the_visible_set() {
|
||||
fn club_excludes_listed_items_and_paginates_the_visible_set() {
|
||||
let core = Arc::new(FakeCore::new(
|
||||
vec![
|
||||
item("oc1", "card_a", 86, "CDM", "Argentina", "Premier League", "Chelsea"),
|
||||
@@ -311,7 +311,7 @@ fn club_excludes_transfer_pile_items_and_paginates_the_visible_set() {
|
||||
let resolver = resolver_for(&[("card_a", 20801), ("card_b", 20802), ("card_c", 20803)]);
|
||||
let ents = entities();
|
||||
|
||||
// oc2 is listed on the transfer market.
|
||||
// oc2 has an active transfer-market listing.
|
||||
let hidden: std::collections::HashSet<String> = ["oc2".to_string()].into_iter().collect();
|
||||
let deps = ClubDeps {
|
||||
core: core.as_ref(),
|
||||
|
||||
Reference in New Issue
Block a user