Skip to content

Commit

Permalink
Fixed a bug that caused null reference in the enrollment report
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Nov 30, 2023
1 parent 92a4b83 commit 79dc186
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { EnrollmentReportFlatParameters, EnrollmentReportParameters, EnrollmentReportStatSummary, EnrollmentReportTab } from './enrollment-report.models';
import { ReportKey, ReportSponsor, ReportViewUpdate } from '@/reports/reports-models';
import { EnrollmentReportService } from '@/reports/components/reports/enrollment-report/enrollment-report.service';
import { Observable, first, firstValueFrom, map } from 'rxjs';
import { Observable, first, firstValueFrom, map, of } from 'rxjs';
import { SimpleEntity } from '@/api/models';
import { ReportComponentBase } from '../report-base.component';
import { DateRangeQueryParamModel } from '@/core/models/date-range-query-param.model';
Expand Down Expand Up @@ -111,6 +111,11 @@ export class EnrollmentReportComponent extends ReportComponentBase<EnrollmentRep
}

private loadSummaryStats(parameters: EnrollmentReportFlatParameters): Observable<EnrollmentReportSummaryStats> {
// still very confused about why this is sometimes null, but it appears not to affect the experience or performance.
if (!this.reportService) {
return of({ importantStat: { label: "--", value: "--" }, otherStats: [] });
}

return this.reportService.getSummaryStats(parameters).pipe(
map(stats => {
const leadingSponsorStat: ReportSummaryStat = {
Expand Down

0 comments on commit 79dc186

Please sign in to comment.