Server/project
Refringe 52172f2953 InsuranceController Quality and Maintainability (!148)
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>
2023-10-12 08:38:22 +00:00
..
.vscode 0.13.5.0 (!147) 2023-10-10 11:03:20 +00:00
assets Make separate bossKill min/max properties + adjust various difficulty values 2023-10-11 17:05:06 +01:00
src InsuranceController Quality and Maintainability (!148) 2023-10-12 08:38:22 +00:00
tests 0.13.5.0 (!147) 2023-10-10 11:03:20 +00:00
.dockerignore Add Repo 2023-03-03 15:23:46 +00:00
.eslintignore Add Repo 2023-03-03 15:23:46 +00:00
.eslintrc.json Add Repo 2023-03-03 15:23:46 +00:00
.nvmrc 0.13.5.0 (!147) 2023-10-10 11:03:20 +00:00
.parcelrc Add Repo 2023-03-03 15:23:46 +00:00
.swcrc Add Repo 2023-03-03 15:23:46 +00:00
babel.config.js Add Repo 2023-03-03 15:23:46 +00:00
base_tsconfig.json Build server against es2021, instead of es2020 2023-07-29 14:26:42 +01:00
docker-compose.yml Add Repo 2023-03-03 15:23:46 +00:00
Dockerfile Add Repo 2023-03-03 15:23:46 +00:00
docs.Dockerfile Add Repo 2023-03-03 15:23:46 +00:00
gulpfile.mjs 0.13.5.0 (!147) 2023-10-10 11:03:20 +00:00
jest.config.ts Add Repo 2023-03-03 15:23:46 +00:00
package.json 0.13.5.0 (!147) 2023-10-10 11:03:20 +00:00
pkgconfig.json 0.13.5.0 (!147) 2023-10-10 11:03:20 +00:00
pnpm.Dockerfile Add Repo 2023-03-03 15:23:46 +00:00
rome.json Disable empty interface errors 2023-07-15 10:43:09 +01:00
Server.code-workspace Add Repo 2023-03-03 15:23:46 +00:00
test_tsconfig.json Add Repo 2023-03-03 15:23:46 +00:00
tsconfig.json Add Repo 2023-03-03 15:23:46 +00:00
typedef_tsconfig.json Add Repo 2023-03-03 15:23:46 +00:00
typedoc.json Add Repo 2023-03-03 15:23:46 +00:00