From 24a637e9e674c23a2fa520f90d24bc9fdb42b734 Mon Sep 17 00:00:00 2001 From: Jesse Lucas Date: Thu, 9 Apr 2020 13:44:08 -0400 Subject: [PATCH] Change device/folder getAll to getEach --- src/app/charts/chart/chart.component.spec.ts | 2 +- src/app/charts/chart/chart.component.ts | 2 +- src/app/services/device.service.ts | 9 ++++++--- src/app/services/folder.service.ts | 11 ++++++----- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/app/charts/chart/chart.component.spec.ts b/src/app/charts/chart/chart.component.spec.ts index 87533587c..41d2df417 100644 --- a/src/app/charts/chart/chart.component.spec.ts +++ b/src/app/charts/chart/chart.component.spec.ts @@ -4,7 +4,7 @@ import { ChartComponent } from './chart.component'; import { HttpClientModule } from '@angular/common/http'; class MockService { - getAll() { + getEach() { // unimplemented } }; diff --git a/src/app/charts/chart/chart.component.ts b/src/app/charts/chart/chart.component.ts index 3e0c72e5d..a4ce30012 100644 --- a/src/app/charts/chart/chart.component.ts +++ b/src/app/charts/chart/chart.component.ts @@ -72,7 +72,7 @@ export class ChartComponent implements OnInit { ngAfterViewInit() { let totalCount: number = 0; - this.service.getAll().subscribe( + this.service.getEach().subscribe( t => { // Count the number of folders and set chart totalCount++; diff --git a/src/app/services/device.service.ts b/src/app/services/device.service.ts index 376c07270..0570502b7 100644 --- a/src/app/services/device.service.ts +++ b/src/app/services/device.service.ts @@ -62,7 +62,10 @@ export class DeviceService { }); } - getAll(): Observable { + /** + * getEach() returns each device + */ + getEach(): Observable { const deviceObservable: Observable = new Observable((observer) => { // TODO return devices if cached @@ -116,8 +119,8 @@ export class DeviceService { } ) }, - err => { console.log("getAll error!", err) }, - () => { console.log("get all complete!") } + err => { console.log("getEach error!", err) }, + () => { console.log("getEach complete!") } ); }); return deviceObservable diff --git a/src/app/services/folder.service.ts b/src/app/services/folder.service.ts index aec61ff81..a41b46436 100644 --- a/src/app/services/folder.service.ts +++ b/src/app/services/folder.service.ts @@ -49,10 +49,11 @@ export class FolderService { } /** - * getAll() finds all folders and uses db status service to - * set all their statuses + * getEach() returns each folder and uses db status service to + * set all their statuses and db completion service to find + * completion */ - getAll(): Observable { + getEach(): Observable { // TODO return this.folders if cached const folderObservable: Observable = new Observable((observer) => { @@ -63,8 +64,8 @@ export class FolderService { // Synchronously get the status of each folder this.getFolderStatusInOrder(observer, 0); }, - err => { console.log("getAll error!", err) }, - () => { console.log("get all complete!") } + err => { console.log("getEach error!", err) }, + () => { console.log("getEach complete!") } ); }); return folderObservable;