this.segments = this.segments.map((s: Partial<RailSegment>, i) => new RailSegment(s));
this.segmentsPlace = this.segments.reduce((acc: Array<IRailSegmentPlace>, s, i) => {
const placesBooked = this.tickets
.filter(t => this.status !== BOOKING_STATUS.OFFLINE_REFUND ? (t.segment_id === s.id && t.status !== RAIL_TICKET_STATUS.REFUNDED) : true)
.map(t => +t.seats_number.replace(/\D/g, ''));
if (placesBooked.length) {
let placesDisplay: string;
if (s.trainCarType !== 'COMMON') {
placesDisplay = `Вагон № ${s.trainCarNumber}, ` + (placesBooked.length === 1 ? $localize`Место` : $localize`Места`) + ' ' + (placesBooked.join(', '));
} else {
placesDisplay = `Вагон № ${s.trainCarNumber}`;
}
acc.push({
segmentId: s.id,
directionDisplay: s.directionDisplay,
trainDisplay: `${s.trainLetter || ''} ${s.trainDescription || ''}`,
placesDisplay
});
}
return acc;
- вот код проблема в том что placesBooked выводится сразу на всех билетах *