Skip to content
Snippets Groups Projects
Commit 27caea77 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4292 avoid unnecessary call

parent 35522421
No related branches found
No related tags found
No related merge requests found
...@@ -210,9 +210,9 @@ describe('VorgangListService', () => { ...@@ -210,9 +210,9 @@ describe('VorgangListService', () => {
expect(vorgangFacade.getVorgangStatistic).toHaveBeenCalled(); expect(vorgangFacade.getVorgangStatistic).toHaveBeenCalled();
}) })
it('should getVorgangList', (done) => { it('should return vorgangStatistic', (done) => {
service.getVorgangStatistic().subscribe(() => { service.getVorgangStatistic().subscribe(vorgangStatistic => {
expect(service.getVorgangList).toHaveBeenCalled(); expect(vorgangStatistic).toEqual(vorgangStatisticStateResource);
done(); done();
}) })
}) })
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
*/ */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ApiRootFacade, ApiRootResource } from '@goofy-client/api-root-shared'; import { ApiRootFacade, ApiRootResource } from '@goofy-client/api-root-shared';
import { EMPTY_STRING, StateResource, createEmptyStateResource, doIfLoadingRequired, isLoaded, isNotNull } from '@goofy-client/tech-shared'; import { EMPTY_STRING, StateResource, createEmptyStateResource, doIfLoadingRequired, isNotNull } from '@goofy-client/tech-shared';
import { Observable, combineLatest } from 'rxjs'; import { Observable, combineLatest } from 'rxjs';
import { filter, map, startWith, tap, withLatestFrom } from 'rxjs/operators'; import { map, startWith, tap, withLatestFrom } from 'rxjs/operators';
import { VorgangFacade } from './+state/vorgang.facade'; import { VorgangFacade } from './+state/vorgang.facade';
import { ROUTE_PARAM_BY_VORGANG_FILTER, buildLinkRel, getSearchLinkRel } from './vorgang-navigation.util'; import { ROUTE_PARAM_BY_VORGANG_FILTER, buildLinkRel, getSearchLinkRel } from './vorgang-navigation.util';
import { VorgangFilter, VorgangListResource, VorgangResource, VorgangStatistic, VorgangView } from './vorgang.model'; import { VorgangFilter, VorgangListResource, VorgangResource, VorgangStatistic, VorgangView } from './vorgang.model';
...@@ -64,11 +64,7 @@ export class VorgangListService { ...@@ -64,11 +64,7 @@ export class VorgangListService {
} }
public getVorgangStatistic(): Observable<StateResource<VorgangStatistic>> { public getVorgangStatistic(): Observable<StateResource<VorgangStatistic>> {
return this.vorgangFacade.getVorgangStatistic().pipe( return this.vorgangFacade.getVorgangStatistic();
withLatestFrom(this.getVorgangList()),
filter(([, vorgangListResource]) => isLoaded(vorgangListResource)),
map(([statistic,]) => statistic),
);
} }
public getSelectedFilterAsRouteParam(): Observable<string> { public getSelectedFilterAsRouteParam(): Observable<string> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment