52172f2953
This pull request aims to refactor the InsuranceController class to improve its code quality and maintainability. The changes include restructuring methods, adding detailed comments, and enhancing the overall logic for processing insured items. Specific changes include: - Updating the `findItemstoDelete()` method (and the entire class, really) to keep track of which items are tagged using a Set. This *ensures* that an item can only be attempted to be deleted once, as Sets cannot contain duplicates. - Changing the method in which we remove insurance packages from the profile. We were iterating over them using a `for` in reverse order and then removing them with a splice and the current index. On paper this should work, but funny things were happening... Sometimes. I've created a new method that removes packages from a profile by matching against the package systemData date, time, and location. This should give us a specific insurance package (as we don't have an ID to use). In addition to this we're fetching a new instance of the profile to edit, instead of modifying packages that are being iterated over as they're being iterated over. ----- I was unable to reproduce the issue where insurance packages were not being removed from the profile, but hopefully these simplified approaches lead to less funny business. Co-authored-by: Refringe <brownelltyler@gmail.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/148 Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com> Co-committed-by: Refringe <refringe@noreply.dev.sp-tarkov.com> |
||
---|---|---|
.. | ||
.vscode | ||
assets | ||
src | ||
tests | ||
.dockerignore | ||
.eslintignore | ||
.eslintrc.json | ||
.nvmrc | ||
.parcelrc | ||
.swcrc | ||
babel.config.js | ||
base_tsconfig.json | ||
docker-compose.yml | ||
Dockerfile | ||
docs.Dockerfile | ||
gulpfile.mjs | ||
jest.config.ts | ||
package.json | ||
pkgconfig.json | ||
pnpm.Dockerfile | ||
rome.json | ||
Server.code-workspace | ||
test_tsconfig.json | ||
tsconfig.json | ||
typedef_tsconfig.json | ||
typedoc.json |