Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Injectable } from '@angular/core';
import deepDiff from 'return-deep-diff';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class ServiceLinesService {
differences = new Subject();
firstClaimObject;
secondClaimObject;
fullObject1;
fullObject2;
samePdiLoaded: boolean;
constructor() { }
getInstance(instance) {
const myNewInstance = Object.assign({}, instance);
// console.log('myNewInstance', myNewInstance);
myNewInstance.serviceLinesService = null;
if (myNewInstance) {
// console.log('instance tableInfoRows', myNewInstance.tableInfoRows);
if (this.firstClaimObject) {
// console.log('first exists');
this.secondClaimObject = myNewInstance;
this.fullObject2 = myNewInstance;
} else {
this.firstClaimObject = myNewInstance;
this.fullObject1 = myNewInstance;
}
if (this.secondClaimObject) {
// console.log('should run twice');
this.compareServiceLine();
}
// console.log('firstClaimObject', this.firstClaimObject);
// console.log('secondClaimObject', this.secondClaimObject);
// console.log('fullObject1', this.fullObject1);
// console.log('fullObject2', this.fullObject2);
}
}
compareServiceLine() {
const obj1 = this.firstClaimObject.tableInfoRows;
const obj2 = this.secondClaimObject.tableInfoRows;
const billingMisc1 = this.firstClaimObject.billingMiscellanous;
const billingMisc2 = this.secondClaimObject.billingMiscellanous;
const miscDiffs = deepDiff(billingMisc1, billingMisc2);
const answer = [];
// console.log('obj1', obj1);
// console.log('obj2', obj2);
obj1.map((o1, index) => {
// console.log('o1', o1);
obj2.map((o2) => {
// answer = ;
if (o1.lineNumber === o2.lineNumber) {
// console.log('o1', o1);
// console.log('o2', o2);
const diffs = deepDiff(o1, o2);
// console.log('diffs', diffs);
if (diffs) {
diffs['lineNumber'] = o1.lineNumber;
// console.log('diffs w/ line#', diffs);
answer.push(diffs);
}
}
});
});
// console.log('answer:', answer);
this.differences.next([answer, miscDiffs]);
}
destroyClaim(isRight, detail) {
if (this.secondClaimObject) {
this.secondClaimObject = null;
this.firstClaimObject = null;
// console.log('destroy method first', this.firstClaimObject);
// console.log('destroy method second', this.secondClaimObject);
}
}
}