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 samples are indicated as late when Turnaround Time is zero #2569

Open
wants to merge 10 commits into
base: 2.x
Choose a base branch
from

Conversation

DanE417
Copy link

@DanE417 DanE417 commented Jun 2, 2024

Description of the issue/feature this PR addresses

Linked issue: #2568

Current behavior before PR

Samples are shown as late when having a Turnaround Time of zero.

Desired behavior after PR is merged

Samples are not shown as late when having a Turnaround Time of zero.

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

@xispa xispa self-requested a review June 5, 2024 11:05
@xispa xispa added the Bug 🐞 label Jun 5, 2024
Copy link
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks @DanE417 for your suggestion. I think you can make it way simpler, please check the comments!

Also, please add an entry at the top of the changelog: https://github.com/senaite/senaite.core/blob/2.x/CHANGES.rst

@xispa xispa changed the title Indicated as late when Turnaround Time is zero Fix samples are indicated as late when Turnaround Time is zero Jun 5, 2024
@xispa
Copy link
Member

xispa commented Jul 15, 2024

Hi @DanE417 , any news regarding this PR?

@DanE417 DanE417 requested a review from xispa July 31, 2024 10:45
Copy link
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DanE417 , everything looks ok now, but before we can merge you need to do the following:

The upgrade step is necessary because existing samples and analyses will still be indicated as late in listings. Reason is that they use the value returned for getDueDate metadata to render the late icon. Likewise, the getDueDate index is used in searches and to sort them in listings too.

The issue only happens for services their TAT is 0 days, 0 hours and 0 minutes. Therefore, the upgrade step will be faster if you search only for analyses their service uid is one of those. You can use the getServiceUID index to search analyses by service uid.

>>> date_future = (DateTime() + 5).strftime("%Y-%m-%d")
>>> client = api.create(portal.clients, "Client", Name="Happy Hills", ClientID="HH", MemberDiscountApplies=True)
>>> contact = api.create(client, "Contact", Firstname="Rita", Lastname="Mohale")
>>> sampletype = api.create(bikasetup.bika_sampletypes, "SampleType", title="Water", Prefix="W")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note test is failing now because of #2584 . Use setup.sampletypes instead of bikasetup.bika_sampletypes

@DanE417 DanE417 requested a review from xispa August 19, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants