Skip to content

Commit

Permalink
Merge pull request #71 from ORNL-AMO/#65---To-do-list-on-loaded-profile
Browse files Browse the repository at this point in the history
#65 - Added Locking System updates to modal duplicate section
  • Loading branch information
CharvelHJohnson authored Apr 24, 2023
2 parents 354a66c + b671a61 commit db40ba0
Showing 1 changed file with 35 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,6 @@ export class UtilityOpticalRecognitionComponent implements OnInit {

ngOnInit(): void {
this.setupBillAttributes();

// set required attributes
this.undefinedMeterData.forEach(subArray => {
if(subArray.includes('Read Date')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Volume')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Energy Use')){
this.toDo.push(subArray[0]);
}
});

this.tempArrayAttributeNames.forEach(subArray => {
if(subArray.includes('Read Date')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Volume')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Energy Use')){
this.toDo.push(subArray[0]);
}
});

// start scan profile
this.newScanProfile = this.scanProfileDbService.getnewUtilityMeterProfile();
this.interface.accountId = this.editMeter.accountId;
Expand Down Expand Up @@ -226,6 +204,28 @@ export class UtilityOpticalRecognitionComponent implements OnInit {
} else{
alert('please upload pdf file')
}
//setup required attributes
this.undefinedMeterData.forEach(subArray => {
if(subArray.includes('Read Date')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Volume')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Energy Use')){
this.toDo.push(subArray[0]);
}
});

this.tempArrayAttributeNames.forEach(subArray => {
if(subArray.includes('Read Date')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Volume')){
this.toDo.push(subArray[0]);
} else if(subArray.includes('Total Energy Use')){
this.toDo.push(subArray[0]);
}
});
//filter out duplicates and single letters (i.e. 'R' 'T');
this.toDo = this.toDo.filter((item, index) => this.toDo.indexOf(item) === index && item.length > 1);
}

public afterLoadComplete(pdf: PDFDocumentProxy) {
Expand Down Expand Up @@ -647,6 +647,7 @@ export class UtilityOpticalRecognitionComponent implements OnInit {
}

}

this.counterVar++;
});

Expand Down Expand Up @@ -676,6 +677,18 @@ export class UtilityOpticalRecognitionComponent implements OnInit {
}
this.add_to_json(this.GetProfile.attribute123, this.ocrResult);
this.set_json();
if(this.GetProfile.attribute123.includes("Read Date")){
this.toDo = this.toDo.filter(item => item !== "Read Date");
} else if(this.GetProfile.attribute123.includes("Total Energy Use")){
this.toDo = this.toDo.filter(item => item !== "Total Energy Use");
} else if(this.GetProfile.attribute123.includes("Total Volume")){
this.toDo = this.toDo.filter(item => item !== "Total Volume");
}

// if toDo list is empty, hide it
if(this.toDo.length == 0){
this.showToDoAlert = false;
}
await (await worker).terminate();
this.startProcessing(null);
this.currentpage = 1;
Expand Down

0 comments on commit db40ba0

Please sign in to comment.