refactor(ticket-selector): stop sending excluded variants
This commit is contained in:
@@ -92,7 +92,6 @@ export class CatalogService extends BaseApiService {
|
|||||||
catalogItemId: number,
|
catalogItemId: number,
|
||||||
payload: {
|
payload: {
|
||||||
selected_values: Record<string, string | string[]>;
|
selected_values: Record<string, string | string[]>;
|
||||||
excluded_variant_ids?: number[];
|
|
||||||
cart_item_id?: number | null;
|
cart_item_id?: number | null;
|
||||||
},
|
},
|
||||||
): Observable<CatalogVariantOptionsResponse> {
|
): Observable<CatalogVariantOptionsResponse> {
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ describe('ProductTicketSelectorComponent', () => {
|
|||||||
|
|
||||||
expect(catalogService.getVariantOptions).toHaveBeenLastCalledWith(7, {
|
expect(catalogService.getVariantOptions).toHaveBeenLastCalledWith(7, {
|
||||||
selected_values: { sector: 'a' },
|
selected_values: { sector: 'a' },
|
||||||
excluded_variant_ids: [],
|
|
||||||
cart_item_id: null,
|
cart_item_id: null,
|
||||||
});
|
});
|
||||||
expect(fixture.componentInstance['rows']()[0].status).toBe('selecting');
|
expect(fixture.componentInstance['rows']()[0].status).toBe('selecting');
|
||||||
|
|||||||
@@ -199,16 +199,9 @@ export class ProductTicketSelectorComponent {
|
|||||||
error: null,
|
error: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const excludedVariantIds = this.rows()
|
|
||||||
.filter((candidate) => candidate.id !== rowId)
|
|
||||||
.flatMap((candidate) => {
|
|
||||||
const variantId = candidate.reservedVariantId ?? candidate.variantId;
|
|
||||||
return variantId === null ? [] : [variantId];
|
|
||||||
});
|
|
||||||
const request = this.catalogService
|
const request = this.catalogService
|
||||||
.getVariantOptions(this.productId(), {
|
.getVariantOptions(this.productId(), {
|
||||||
selected_values: selectedValues,
|
selected_values: selectedValues,
|
||||||
excluded_variant_ids: excludedVariantIds,
|
|
||||||
cart_item_id: row.cartItemId,
|
cart_item_id: row.cartItemId,
|
||||||
})
|
})
|
||||||
.subscribe({
|
.subscribe({
|
||||||
|
|||||||
Reference in New Issue
Block a user