From: Jane Sandberg Date: Fri, 14 Aug 2020 23:55:02 +0000 (-0700) Subject: LP1849212: display course information in catalog for record-only acmcm entries X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ac7469d19911a6ae48c660917ccf99ee21e4c518;p=working%2FEvergreen.git LP1849212: display course information in catalog for record-only acmcm entries Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html index 27a0d545ec..a585474281 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html @@ -42,14 +42,14 @@ - - @@ -59,7 +59,7 @@ @@ -81,14 +81,14 @@
-
Phys. Desc.: - Phys. Desc.: +
-
Edition: - Edition: +
@@ -101,31 +101,31 @@
-
Pub Date: +
Pub Date:
-
ISBN: - ISBN: +
-
UPC: - UPC: +
-
ISSN: - ISSN: +
- +
Associated Courses: @@ -139,7 +139,7 @@
-
@@ -171,7 +171,7 @@
Created {{summary.record.create_date() | date:'shortDate'}} by - {{summary.record.creator().usrname()}} @@ -184,7 +184,7 @@
Edited {{summary.record.edit_date() | date:'shortDate'}} by - {{summary.record.editor().usrname()}} diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts index d587f5a0ba..31f7d02588 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts @@ -30,7 +30,7 @@ export class ResultRecordComponent implements OnInit, OnDestroy { searchContext: CatalogSearchContext; isRecordSelected: boolean; basketSub: Subscription; - has_course: boolean; + hasCourse = false; courses: any[] = []; constructor( @@ -62,17 +62,14 @@ export class ResultRecordComponent implements OnInit, OnDestroy { } loadCourseInformation(recordId) { - console.log("Entering loadCourseInformation"); this.course.isOptedIn().then(res => { if (res) { - this.course.fetchCopiesInCourseFromRecord(recordId).then(course_list => { + this.course.fetchCoursesForRecord(recordId).then(course_list => { Object.keys(course_list).forEach(key => { this.courses.push(course_list[key]); }); - this.has_course = true; + this.hasCourse = true; }); - } else { - this.has_course = false; } }); } diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html index a8e39532d3..16426c22ec 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html @@ -15,12 +15,12 @@
- +
@@ -91,7 +91,7 @@
{{summary.record.edit_date() | date:'short'}}
- +
  • Associated Courses
    diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts index edd73bf57f..9103dea1ee 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts @@ -14,7 +14,7 @@ import {CatalogService} from '@eg/share/catalog/catalog.service'; export class BibSummaryComponent implements OnInit { initDone = false; - has_course = false; + hasCourse = false; courses: any; // True / false if the display is vertically expanded @@ -78,15 +78,13 @@ export class BibSummaryComponent implements OnInit { }); } - loadCourseInformation(record_id) { + loadCourseInformation(recordId) { this.org.settings('circ.course_materials_opt_in').then(setting => { if (setting['circ.course_materials_opt_in']) { - this.course.fetchCopiesInCourseFromRecord(record_id).then(course_list => { - this.courses = course_list; - this.has_course = true; + this.course.fetchCoursesForRecord(recordId).then(courseList => { + this.courses = courseList; + this.hasCourse = true; }); - } else { - this.has_course = false; } }); } diff --git a/Open-ILS/src/eg2/src/app/staff/share/course.service.ts b/Open-ILS/src/eg2/src/app/staff/share/course.service.ts index 2aa18b7823..f8d464df6d 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/course.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/course.service.ts @@ -82,23 +82,12 @@ export class CourseService { }); } - fetchCopiesInCourseFromRecord(record_id) { - const cp_list = []; - return new Promise((resolve, reject) => { - this.net.request( - 'open-ils.cat', - 'open-ils.cat.asset.copy_tree.global.retrieve', - this.auth.token(), record_id - ).subscribe(copy_tree => { - copy_tree.forEach(cn => { - cn.copies().forEach(cp => { - cp_list.push(cp.id()); - }); - }); - }, err => reject(err), - () => { - resolve(this.getCoursesFromMaterial(cp_list)); - }); + fetchCoursesForRecord(recordId) { + return this.pcrud.search( + 'acmcm', {record: recordId}, {atomic: true} + ).toPromise().then((materials) => { + const courseIds = materials.map((material) => material.course()); + return this.getCourses(Array.from(new Set(courseIds))); }); }