stb-kslater3 / Admin_Checklist

Tool used by Sales Team to determine Quotes, and other things
0 stars 0 forks source link

Double Body PO #6

Closed stb-kslater3 closed 3 years ago

stb-kslater3 commented 3 years ago

The Body PO on this admin checklist is getting pulled as both a Body and an Other. The first couple things that come to mind for potential sources:

stb-kslater3 commented 3 years ago

It works correctly in RSPilot, so what is different about Production?

stb-kslater3 commented 3 years ago

In any case. There are 2 possibilities off the top of my head for why this would be double placing a body PO. Either, getPOs( ) is double giving me that Body PO, or loadPOsFromPOLines( ) has a mistake in the logic when it goes and says find the body and take it out of the "others" list.

stb-kslater3 commented 3 years ago

I checked and it definitely only gives 1 body in the call to getPOs( ). So it comes down to finding out why I added it twice within loadPOsFromPOLines( ). . . . Okay I found the culprit. I was using Javascripts Array.prototype.find instead of Array.prototype.findIndex on "others" and so when I went to Splice I wasn't splicing on the correct index. Also, I performed a check before splicing that used the return value of find which if 0 would be falsy, so if the first other found was body then it would not splice it. Anyway fixed those