Skip to content

Commit

Permalink
#616 bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
arawinters committed Jan 3, 2024
1 parent f0bf037 commit 8c8d6a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/lib/charts/records-by-datasources/sz-donut.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class SzRecordStatsDonutChart implements OnInit, OnDestroy {
return this._totalPendingRecordCount;
}
get totalDataSources(): number {
let retVal = (this._dataSourceCountsByCode.size) ? this._dataSourceCountsByCode.size : 0;
let retVal = (this._dataSourceCountsByCode && this._dataSourceCountsByCode.size) ? this._dataSourceCountsByCode.size : 0;
return retVal;
}
/*
Expand Down Expand Up @@ -172,7 +172,7 @@ export class SzRecordStatsDonutChart implements OnInit, OnDestroy {

get dataSourceCounts(): SzRecordCountDataSource[] {
let retVal = this._dataSourceCounts;
if(this._unlistedDataSources && this._unlistedDataSources.length > 0) {
if(this._unlistedDataSources && this._unlistedDataSources.length > 0 && this._dataSourceCounts) {
// hand back datasource counts minus the unlisted items
retVal = this._dataSourceCounts.filter((ds) => {
return this._unlistedDataSources.indexOf(ds.dataSourceCode) === -1;
Expand Down Expand Up @@ -230,7 +230,6 @@ export class SzRecordStatsDonutChart implements OnInit, OnDestroy {
takeUntil(this.unsubscribe$)
).subscribe({
next: (recordCounts: SzRecordCountDataSource[])=>{
console.log(`got counts: `, recordCounts);
if(this._dataSourceCounts && this._dataSources) {
this.dataChanged.next(this._dataSourceCounts);
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/configuration/sz-license/sz-license.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ export class SzLicenseInfoComponent implements OnInit {
ngOnInit() {
this.dmService.onCountStats.pipe(filter( (val) => val !== undefined)).subscribe( (resp: SzCountStats) => {
this._countStats = resp;
if(this._countStats.totalRecordCount) this._recordCount = this._countStats.totalRecordCount;
if(this._countStats.totalRecordCount) {
this._recordCount = this._countStats.totalRecordCount;
}
});
this.adminService.onLicenseInfo.subscribe( (resp: SzLicenseInfo) => {
this._licenseInfo = resp;
Expand Down
8 changes: 7 additions & 1 deletion src/lib/services/sz-datamart.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export class SzDataMartService {
constructor(private http: HttpClient, private statsService: SzStatisticsService) {}

public getLoadedStatistics(): Observable<SzCountStatsForDataSourcesResponse> {
return this.statsService.getLoadedStatistics();
return this.statsService.getLoadedStatistics().pipe(
tap((response) => {
if(response && response.data) {
this.onCountStats.next(response.data);
}
})
)
/*
let retVal = new Observable<SzCountStatsForDataSourcesResponse>();
// for now just return stub data
Expand Down

0 comments on commit 8c8d6a1

Please sign in to comment.