this.globalService.subECHAPICListSubstance(true,…
- User
this._globalService.subECHAPICListSubstance(true, true).pipe(takeUntil(this.ngUnsubscribe)) .subscribe(async (substanceFromECHAPIC) => { if (substanceFromECHAPIC) { this._substanceFromECHAPIC = substanceFromECHAPIC; } (this.dataSource || []).forEach((item) => { item.isPortal = this.request.isSdsPortal && !this.request.isSdsPortalSecond; item.isPortalSecond = this.request.isSdsPortalSecond; if (!item.isPortal && !item.isPortalSecond) { const chemicalSubstanceForBL: ChemicalSubstanceForBlackList = { name: item.name, casNumber: item.casNumber, ecNumber: item.ecNumber, chemicalSubstanceEntityId: item.entityId, chemicalComposition: listMixturesChemical ? listMixturesChemical.find( (mc) => mc.chemicalSubstanceEntityId === item.entityId )?.listChemicalComposition : [], id: item.id }; const listSubstanceFromECHAPIC = commonFunction.getBlackListByChemicalSubstance( this.isCheckMixturesChemical, chemicalSubstanceForBL, this._substanceFromECHAPIC ); item.isBlackList = !!( listSubstanceFromECHAPIC && listSubstanceFromECHAPIC.length ); const lstNameOfBackList = [ ...new Set( listSubstanceFromECHAPIC.map( (item) => item.blackListName ) ) ]; item.blackListToolTip = lstNameOfBackList.join(', '); } }); this.sdsIds = this.dataSource.map(x => x.idChemicalFromSDSManager); await this._checkChemicalExistedInLocation(); // Add banner for selected chemical if ( this.selectedChemicalEntityIds && this.selectedChemicalEntityIds.length && this.bannerDescription ) { this.dataSource .filter((item) => this.selectedChemicalEntityIds.includes( this.isChemicalMode ? item.id : item.entityId ) ) .forEach((item) => { const banner: ChemicalSubstanceBannerModel = { type: BannerType.primary, contents: this._buildBannerContents( this.bannerDescription, [] ) }; item.banners = []; item.banners.push(banner); }); } this.totalCount = dataRes.totalCount; this issue call repeat in result many time subECHAPICListSubstance(reload = false, ignoreLoading = false): Observable<SubstitutionCopyRightModel[]> { if (reload || !this.echa_substances) { const emptyOb: Observable<SubstitutionCopyRightModel[]> = Observable.create((ob) => { ob.next([]); ob.complete(); }); combineLatest( [environment.sdsPortalEnable || environment.sdsPortalSIKTEnable ? this.getAllBlackListSDS(true, ignoreLoading, true, reload) : emptyOb, this.getAllBlackListSDS(false, ignoreLoading, false, reload)] ).subscribe(async response => { const dataGlobal = response[0] || []; let filterDataGlobal = []; if (dataGlobal.length > 0 && !environment.server.isAnonymous) { filterDataGlobal = await this.filterDataGlobalBlackList(dataGlobal); } const dataLocal = response[1] || []; this._echa_substances.next(filterDataGlobal.concat(dataLocal)); }); } return this.echa_substances; } private _echa_substances = new BehaviorSubject<SubstitutionCopyRightModel[]>([]); echa_substances$ = this._echa_substances.asObservable();
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.