Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initial IDs not starting with 1 #1453

Merged
merged 8 commits into from
Oct 14, 2019
Merged

Fix initial IDs not starting with 1 #1453

merged 8 commits into from
Oct 14, 2019

Conversation

ramonski
Copy link
Contributor

Description of the issue/feature this PR addresses

When the ID Server does not find the generated key in its storage, e.g. for Sample Conditions the key samplecondition, it tries to handle the case when the storage was flushed and searches for all objects starting with this prefix.

Unfortunately, the temporary generated ID of the current context is there included, e.g. samplecondition.2019-10-10.5905228809 and the sequence number returns 10 in that case.

PDB Excerpt from https://github.com/senaite/senaite.core/blob/master/bika/lims/idserver.py#L457:

(Pdb++) a
context = <SampleCondition at samplecondition.2019-10-10.5905228809>
config = {'prefix': 'samplecondition', 'form': 'samplecondition-{seq}', 'sequence_type': 'generated'}
variables = {'seq': 0, 'parent': <SampleConditions at /senaitelims/bika_setup/bika_sampleconditions>, 'portal_type': 'SampleCondition', 'context': <SampleCondition at /senaitelims/bika_setup/bika_sampleconditions/samplecondition.2019-10-10.5905228809>, 'year': '19', 'alpha': AAA000, 'id': 'samplecondition.2019-10-10.5905228809'}
kw = {}
(Pdb++) context.id
'samplecondition.2019-10-10.5905228809'
(Pdb++) existing
['samplecondition.2019-10-10.5905228809']

Current behavior before PR

Initial IDs started with the sequence 11

Desired behavior after PR is merged

Initial IDs start with the sequence 1

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

Remove temporary ID from existing IDs
@ramonski ramonski changed the title Fix initial IDs starting with 11 Fix initial IDs not starting with 1 Oct 10, 2019
@xispa xispa merged commit 03dfc11 into master Oct 14, 2019
@ramonski ramonski deleted the fix-initial-generated-ids branch October 26, 2019 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants