const summary = new BibRecordSummary(metabibSummary.record, orgId);
summary.net = this.net; // inject
summary.metabibId = Number(metabibSummary.metabib_id);
+ summary.metabibRecords = metabibSummary.metabib_records;
summary.display = metabibSummary.display;
summary.attributes = metabibSummary.attributes;
summary.holdCount = metabibSummary.hold_count;
</div>
<div
[ngClass]="{'col-lg-10': !searchContext.basket, 'col-lg-12': searchContext.basket}">
- <div *ngIf="shouldStartRendering()">
- <div *ngFor="let summary of searchContext.result.records; let idx = index">
- <div *ngIf="summary">
- <eg-catalog-result-record [summary]="summary" [index]="idx">
- </eg-catalog-result-record>
- </div>
+ <div *ngFor="let summary of searchContext.result.records; let idx = index">
+ <div *ngIf="summary">
+ <eg-catalog-result-record [summary]="summary" [index]="idx">
+ </eg-catalog-result-record>
</div>
</div>
</div>
}
}
- // Records file into place randomly as the server returns data.
- // To reduce page display shuffling, avoid showing the list of
- // records until the first few are ready to render.
- shouldStartRendering(): boolean {
- return this.searchHasResults();
-
- /*
- if (this.searchHasResults()) {
- const pageCount = this.searchContext.currentResultIds().length;
- switch (pageCount) {
- case 1:
- return this.searchContext.result.records[0];
- default:
- return this.searchContext.result.records[0]
- && this.searchContext.result.records[1];
- }
- }
-
- return false;
- */
- }
-
searchIsDone(): boolean {
return this.searchContext.searchState === CatalogSearchState.COMPLETE;
}
{desc => 'Array of Record IDs', type => 'array'}
],
return => {
- desc => 'Stream of record summary objects'
+ desc => q/
+ Stream of record summary objects including id, record,
+ hold_count, copy_counts, display (metabib display
+ fields), attributes (metabib record attrs), plus
+ metabib_id and metabib_records for the metabib variant.
+ /
}
}
);
return undef;
}
+# Start with a bib summary and augment the data with additional
+# metarecord content.
sub get_one_metarecord_summary {
my ($e, $rec_id) = @_;
$response->{metabib_id} = $rec_id;
$response->{metabib_records} = [map {$_->source} @$maps];
- # augment mraf
+ my @other_bibs = map {$_->source} grep {$_->source != $bre_id} @$maps;
+ # Augment the record attributes with those of all of the records
+ # linked to this metarecord.
+ if (@other_bibs) {
+ my $attrs = $e->search_metabib_record_attr_flat({id => \@other_bibs});
+
+ my $attributes = $response->{attributes};
+
+ for my $attr (@$attrs) {
+ $attributes->{$attr->attr} = [] unless $attributes->{$attr->attr};
+ push(@{$attributes->{$attr->attr}}, $attr->value) # avoid dupes
+ unless grep {$_ eq $attr->value} @{$attributes->{$attr->attr}};
+ }
+ }
+
+ return $response;
}
sub get_one_record_summary {
}
}]) or return {};
+ # Compressed display fields are pachaged as JSON
my $display = {};
$display->{$_->name} = OpenSRF::Utils::JSON->JSON2perl($_->value)
foreach @{$bre->compressed_display_entries};