Skip to content

Number of batch samples#2789

Open
Lunga001 wants to merge 2 commits into
senaite:2.xfrom
bikalims:number-of-batch-samples
Open

Number of batch samples#2789
Lunga001 wants to merge 2 commits into
senaite:2.xfrom
bikalims:number-of-batch-samples

Conversation

@Lunga001
Copy link
Copy Markdown
Contributor

Description of the issue/feature this PR addresses

On th batch listing(batches) add a column that shows the number of samples
image

Current behavior before PR

On the Batch Listing(Batches) there isn't a column that shows the number of samples that are on the batch

Desired behavior after PR is merged

To have a column that shows the number of samples that are on a batch.
image

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

@ramonski
Copy link
Copy Markdown
Contributor

Hi @Lunga001, this PR is still marked as "Draft".
Was this by accident or what is the current status of this PR?

@ramonski ramonski added the Feature 🪚 New feature request label Dec 10, 2025
@Lunga001
Copy link
Copy Markdown
Contributor Author

Hi @ramonski I missed this one, I wasn't sure if getNumberOfSamples need to be added as an index instead waking up the object even though it seemed we are already got the object from the previous lines.

@Lunga001 Lunga001 marked this pull request as ready for review December 10, 2025 10:42
@ramonski
Copy link
Copy Markdown
Contributor

Hi @Lunga001,
since you are just counting the samples, you don't need to retrieve the full objects from getAnalysisRequests. Instead, you could just use getAnalysisRequestsBrains:
https://github.com/senaite/senaite.core/blob/2.x/src/bika/lims/content/batch.py#L237-L242

Regarding the sorting, it is a bit tricky because any index would need to get updated as soon as samples are assigned/unassigned from a batch. Therefore, I would rely on the manual sorting.

Maybe a good idea would be to move the count method directly to the Batch content class.

@ramonski ramonski self-requested a review December 10, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature 🪚 New feature request

Development

Successfully merging this pull request may close these issues.

3 participants