diff --git a/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.html b/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.html
index faf48eac7..0a567bd0a 100644
--- a/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.html
+++ b/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.html
@@ -9,23 +9,38 @@
-
diff --git a/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts b/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts
index 001f005a1..a40ab9114 100644
--- a/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts
+++ b/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts
@@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, Input, LOCALE_ID, OnDestroy, OnInit } from '@angular/core';
import { EChartsOption } from 'echarts';
-import { Observable, Subscription, combineLatest, fromEvent } from 'rxjs';
+import { Observable, Subscription, combineLatest, fromEvent, share } from 'rxjs';
import { startWith, switchMap, tap } from 'rxjs/operators';
import { SeoService } from '../../../services/seo.service';
import { formatNumber } from '@angular/common';
@@ -41,8 +41,7 @@ export class AccelerationFeesGraphComponent implements OnInit, OnDestroy {
renderer: 'svg',
};
- hrStatsObservable$: Observable;
- statsObservable$: Observable;
+ aggregatedHistory$: Observable;
statsSubscription: Subscription;
isLoading = true;
formatNumber = formatNumber;
@@ -50,6 +49,7 @@ export class AccelerationFeesGraphComponent implements OnInit, OnDestroy {
chartInstance: any = undefined;
currency: string;
+ daysAvailable: number = 0;
constructor(
@Inject(LOCALE_ID) public locale: string,
@@ -81,7 +81,7 @@ export class AccelerationFeesGraphComponent implements OnInit, OnDestroy {
this.radioGroupForm.controls.dateSpan.setValue(fragment, { emitEvent: false });
}
});
- this.statsObservable$ = combineLatest([
+ this.aggregatedHistory$ = combineLatest([
this.radioGroupForm.get('dateSpan').valueChanges.pipe(
startWith(this.radioGroupForm.controls.dateSpan.value),
switchMap((timespan) => {
@@ -95,14 +95,17 @@ export class AccelerationFeesGraphComponent implements OnInit, OnDestroy {
),
fromEvent(window, 'resize').pipe(startWith(null)),
]).pipe(
- tap(([history]) => {
+ tap(([response]) => {
+ const history: Acceleration[] = response.body;
+ this.daysAvailable = (new Date().getTime() / 1000 - response.headers.get('x-oldest-accel')) / (24 * 3600);
this.isLoading = false;
this.prepareChartOptions(history);
this.cd.markForCheck();
- })
+ }),
+ share(),
);
- this.statsObservable$.subscribe();
+ this.aggregatedHistory$.subscribe();
}
prepareChartOptions(data) {
diff --git a/frontend/src/app/services/services-api.service.ts b/frontend/src/app/services/services-api.service.ts
index f41c5b42c..ad8af5536 100644
--- a/frontend/src/app/services/services-api.service.ts
+++ b/frontend/src/app/services/services-api.service.ts
@@ -145,8 +145,8 @@ export class ServicesApiServices {
return this.httpClient.get(`${SERVICES_API_PREFIX}/accelerator/accelerations`);
}
- getAggregatedAccelerationHistory$(params: AccelerationHistoryParams): Observable {
- return this.httpClient.get(`${SERVICES_API_PREFIX}/accelerator/accelerations/history/aggregated`, { params: { ...params } });
+ getAggregatedAccelerationHistory$(params: AccelerationHistoryParams): Observable {
+ return this.httpClient.get(`${SERVICES_API_PREFIX}/accelerator/accelerations/history/aggregated`, { params: { ...params }, observe: 'response' });
}
getAccelerationHistory$(params: AccelerationHistoryParams): Observable {