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

Do not show hidden values in the barchart List sample label menu option results #2593

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions client/plots/barchart.events.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,22 @@ async function listSamples(event, self, seriesId, dataId, chartId) {
for (const sample of data.lst) {
const sampleName = data.refs.bySampleId[Number(sample.sample)].label
const row = [{ value: sampleName }]
/** Don't show hidden values in the results
* May not be caught in server request for custom variables
* with user supplied keys */
if (self.config.term.q?.hiddenValues && `${sample[self.config.term.$id].key}` in self.config.term.q.hiddenValues)
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to add additional check with optional chaining to check against the .key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really. The in operator make this safer since the string value itself could be anything: str | undefined | null

Copy link
Collaborator

Choose a reason for hiding this comment

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

i suggest to look into a backend fix instead

continue
if (termIsNumeric) {
const value = sample[self.config.term.$id]?.value
row.push({ value: roundValueAuto(value) })
}
if (self.config.term2) {
//Don't show hidden values in the results
if (
self.config.term2.q?.hiddenValues &&
`${sample[self.config.term2.$id].key}` in self.config.term2.q.hiddenValues
)
continue
let value = sample[self.config.term2.$id]
if (!value) row.push({ value: '' })
else {
Expand Down
3 changes: 2 additions & 1 deletion release.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

Fixes:
- Do not show hidden values in the barchart `List sample` label menu option results.
Loading