From 0e295ae4411c41522ae460462e78dc32116668dc Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Mon, 2 Dec 2024 07:12:29 -0500 Subject: [PATCH] fixing lint --- modules/biobank/jsx/header.js | 3 +++ modules/biobank/jsx/poolSpecimenForm.js | 33 ++++++++++++++----------- modules/biobank/jsx/specimenForm.js | 8 +++--- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/modules/biobank/jsx/header.js b/modules/biobank/jsx/header.js index 168ecb18f84..bda295a5679 100644 --- a/modules/biobank/jsx/header.js +++ b/modules/biobank/jsx/header.js @@ -220,6 +220,9 @@ Header.propTypes = { coordinate: PropTypes.string, }).isRequired, specimen: PropTypes.shape({ + barcode: PropTypes.string, + candidatePSCID: PropTypes.string, + sampleNumber: PropTypes.string, quantity: PropTypes.number, poolId: PropTypes.number, typeId: PropTypes.number.isRequired, diff --git a/modules/biobank/jsx/poolSpecimenForm.js b/modules/biobank/jsx/poolSpecimenForm.js index abc9d26e2f8..fc8e3abbc6a 100644 --- a/modules/biobank/jsx/poolSpecimenForm.js +++ b/modules/biobank/jsx/poolSpecimenForm.js @@ -21,7 +21,7 @@ const initialState = { candidateId: null, sessionid: null, typeId: null, - centerId: null + centerId: null, }, poolId: null, count: 0, @@ -40,7 +40,7 @@ class PoolSpecimenForm extends React.Component { super(); this.state = initialState; this.setPool = this.setPool.bind(this); - this.setFilter = this.setFilter.bind(this); + this.setFilter = this.setFilter.bind(this); this.validateListItem = this.validateListItem.bind(this); this.setPoolList = this.setPoolList.bind(this); } @@ -64,7 +64,6 @@ class PoolSpecimenForm extends React.Component { * @param {string} value - the filter values */ setFilter(name, value) { - console.log(name+': '+value); const {filter} = clone(this.state); if (name == 'candidateId') { @@ -73,7 +72,7 @@ class PoolSpecimenForm extends React.Component { filter[name] = value; this.setState({filter}); - } + } /** * Sets the current pool list @@ -81,7 +80,7 @@ class PoolSpecimenForm extends React.Component { * @param {number} containerId - specimen to be added to pool via containerId */ setPoolList(containerId) { - let {current, list, pool, count} = clone(this.state); + let {filter, list, pool, count} = clone(this.state); // Increase count count++; @@ -95,7 +94,7 @@ class PoolSpecimenForm extends React.Component { filter.candidateId = specimen.candidateId; filter.sessionId = specimen.sessionId; filter.typeId = specimen.typeId; - filter.centerId = container.centerId; + filter.centerId = container.centerId; } // Set list values @@ -147,7 +146,7 @@ class PoolSpecimenForm extends React.Component { const specimen = this.props.data.specimens[container.specimenId]; // Throw error if new list item does not meet requirements. - if (!isEmpty(list) + if (!isEmpty(list) && (specimen.candidateId != filter.candidateId || specimen.sessionId != filter.sessionId || specimen.typeId != filter.typeId @@ -236,7 +235,10 @@ class PoolSpecimenForm extends React.Component { onUserInput={this.setFilter} disabled={!isEmpty(list) || !filter.candidateId} value={filter.sessionId} - options={mapFormOptions((options?.candidateSessions?.[filter.candidateId] || {}), 'label')} + options={mapFormOptions( + (options?.candidateSessions?.[filter.candidateId] || {}), + 'label' + )} />
@@ -348,12 +350,8 @@ PoolSpecimenForm.propTypes = { }) ).isRequired, }).isRequired, - filter: PropTypes.shape({ - candidateId: PropTypes.string, - sessionId: PropTypes.string, - typeId: PropTypes.string, - }).isRequired, options: PropTypes.shape({ + candidateSessions: PropTypes.obj, specimen: PropTypes.shape({ units: PropTypes.string, types: PropTypes.arrayOf(PropTypes.string), @@ -395,7 +393,7 @@ class BarcodeInput extends PureComponent { const sessionMatch = !filter.sessionId || specimen.sessionId == filter.sessionId; const typeMatch = !filter.typeId - || specimen.typeId == filter.typeId; + || specimen.typeId == filter.typeId; if (specimen.quantity > 0 && container.statusId == availableId @@ -404,7 +402,7 @@ class BarcodeInput extends PureComponent { && candidateMatch && sessionMatch && typeMatch - ) { + ) { result[container.id] = container.barcode; } } @@ -444,6 +442,11 @@ BarcodeInput.propTypes = { }) ).isRequired, }).isRequired, + filter: PropTypes.shape({ + candidateId: PropTypes.string, + sessionId: PropTypes.string, + typeId: PropTypes.string, + }).isRequired, options: PropTypes.shape({ container: PropTypes.shape({ types: PropTypes.arrayOf( diff --git a/modules/biobank/jsx/specimenForm.js b/modules/biobank/jsx/specimenForm.js index 489f0d3dca2..1a4cb9b2f8b 100644 --- a/modules/biobank/jsx/specimenForm.js +++ b/modules/biobank/jsx/specimenForm.js @@ -164,7 +164,9 @@ class SpecimenForm extends React.Component { */ async fetchBarcodes(limit) { try { - const response = await fetch(`${loris.BaseURL}/biobank/barcodes?limit=${limit}`); + const response = await fetch( + `${loris.BaseURL}/biobank/barcodes?limit=${limit}` + ); const data = await response.json(); return data.barcodes; } catch (error) { @@ -177,12 +179,10 @@ class SpecimenForm extends React.Component { * Generate barcodes and store in the component state. */ async generateBarcodes() { - const {options} = this.props; - let {list, current} = this.state; + let {list} = this.state; const limit = Object.keys(list).length; const barcodes = await this.fetchBarcodes(limit); - console.log(barcodes); list = Object.keys(list).reduce((result, key, index) => { const specimen = list[key];