ems-backend
ems-backend copied to clipboard
Ab#61479 fix incremental id problem
Description
Incremental IDs are sometimes created in duplicate as they are based on the previous record. If records are deleted from the database, it creates a mess. I fixed it but the method is heavier as we need to check all the existing records. Upon testing it on the UAT server, it took 100 times more than the previous method.
Ticket
https://dev.azure.com/WHOHQ/EMSSAFE/_workitems/edit/61479/
Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Improvement (refactor or addition to existing functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
How Has This Been Tested?
Tried to: Create a record for a non existant form, create another form with same starting letter. Add records for both. Delete record from database. Adding new record correctly fills the hole. Adding record to form with no hole works correctly.
Checklist:
( * == Mandatory )
- [x] * My code follows the style guidelines of this project
- [x] * Linting does not generate new warnings
- [x] * I have performed a self-review of my own code
- [x] * I have commented my code, particularly in hard-to-understand areas
- [x] * I have put JSDoc comment in all required places
- [x] * My changes generate no new warnings
- [x] * I have included screenshots describing my changes if relevant
- [x] * I have selected labels in the Pull Request, according to the changes with code brings
- [ ] I have made corresponding changes to the documentation ( if required )
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules