},
{anonymous: true} // skip unneccesary auth
).pipe(mergeMap(bib => {
+ console.debug('pcrud grabbed record', bib.id());
const summary = new BibRecordSummary(bib, orgId, orgDepth);
summary.net = this.net; // inject
summary.ingest();
+ console.debug('fetching holdings for record', bib.id());
return this.getHoldingsSummary(bib.id(), orgId, orgDepth)
- .then(holdingsSummary => {
- summary.holdingsSummary = holdingsSummary;
- return summary;
- });
+ .then(
+ holdingsSummary => {
+ summary.holdingsSummary = holdingsSummary;
+ return summary;
+ },
+ notOk => {
+ console.error('Holdings summary failed', notOk);
+ return Promise.reject(null);
+ }
+ );
}));
}
const holdingsSummary = [];
+ console.debug('Fetching holdings for ', recordId);
return this.unapi.getAsXmlDocument({
target: isMetarecord ? 'mmr' : 'bre',
id: recordId,
orgId: orgId,
depth: orgDepth
}).then(xmlDoc => {
+ console.debug('Holdings doc fetched', xmlDoc);
// namespace resolver
const resolver: any = (prefix: string): string => {
holdingsSummary.push(counts);
}
+ console.debug('Done compiling holdings summary for',
+ recordId, holdingsSummary);
return holdingsSummary;
});
}
idx = ctx.currentResultIds().indexOf(summary.id);
}
+ console.debug('fetched summary for record index', idx);
if (ctx.result.records) {
// May be reset when quickly navigating results.
ctx.result.records[idx] = summary;
this.cat.search(this.searchContext)
.then(ok => {
this.cat.fetchFacets(this.searchContext);
+ console.debug('Fetching bib summaries');
this.cat.fetchBibSummaries(this.searchContext)
- .then(ok2 => this.fleshSearchResults());
+ .then(
+ ok2 => {
+ console.debug('bib summaries fetching succeeded');
+ this.fleshSearchResults();
+ },
+ notOk => {
+ console.error('bib summary fetching failed!', notOk);
+ }
+ );
});
}
}
}
fleshSearchResults(): void {
+ console.log('fleshSearchResults() 1');
const records = this.searchContext.result.records;
if (!records || records.length === 0) { return; }
+ console.log('fleshSearchResults() 2');
// Flesh the creator / editor fields with the user object.
this.bib.fleshBibUsers(records.map(r => r.record));