From 8fff7d25278af39abe2d21d2fbc649b18529aad1 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 29 Aug 2019 11:19:18 +0530 Subject: [PATCH] updated --- .../home/latestblocks/latestblocks.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/view/home/latestblocks/latestblocks.component.ts b/src/app/view/home/latestblocks/latestblocks.component.ts index 22da767..b58ddff 100644 --- a/src/app/view/home/latestblocks/latestblocks.component.ts +++ b/src/app/view/home/latestblocks/latestblocks.component.ts @@ -15,6 +15,7 @@ import { BlockAppendComponent } from '../block-append/block-append.component'; export class LatestblocksComponent implements OnInit { public hashvalues: any; public pagedata: any = []; + public Merged_data: any = []; public CurrentpageNumber: Number; public FirstPageListData: any = []; public DifferentList: any = []; @@ -75,13 +76,19 @@ export class LatestblocksComponent implements OnInit { if (this.CurrentpageNumber == 1) { // console.log("Enter If"); - console.log("socket result", this.blockdetails.BlockchainBlockResult); - console.log("First page result",this.FirstPageListData); + - var onlyInA = this.FirstPageListData.filter(this.comparer(this.blockdetails.BlockchainBlockResult)); - var onlyInB = this.blockdetails.BlockchainBlockResult.filter(this.comparer(this.FirstPageListData)); + var ids = new Set(this.blockdetails.BlockchainBlockResult.map(d => d.blockchain_block_height)); + this.Merged_data = [...this.blockdetails.BlockchainBlockResult, ...this.FirstPageListData.filter(d => !ids.has(d.blockchain_block_height))]; + + var onlyInA = this.FirstPageListData.filter(this.comparer(this.Merged_data)); + var onlyInB = this.Merged_data.filter(this.comparer(this.FirstPageListData)); this.DifferentList = onlyInA.concat(onlyInB); + + console.log("socket result", this.Merged_data); + console.log("First page result",this.FirstPageListData); + this.DifferentList.forEach(DifferentList => { this.FirstPageListData.unshift(DifferentList); //this.createBlock(DifferentList)