Skip to content

Commit cada2b9

Browse files
author
Saket Hatwar
committed
fixes
1 parent adcf070 commit cada2b9

File tree

1 file changed

+39
-48
lines changed

1 file changed

+39
-48
lines changed

modules/behavioural_qc/jsx/tabs_content/behaviouralFeedback.js

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -81,77 +81,68 @@ class BehaviouralFeedback extends Component {
8181
* @return {*} a formatted table cell for a given column
8282
*/
8383
formatColumn(column, cell, rowData, rowHeaders) {
84-
let reactElement;
85-
switch (column) {
86-
case 'PSCID':
87-
reactElement = (
84+
const {t} = this.props;
85+
const labelPSCID = t('PSCID', {ns: 'loris'});
86+
const labelDCCID = t('DCCID', {ns: 'loris'});
87+
const labelBVL = t('Feedback Level', {ns: 'behavioural_qc'});
88+
89+
// PSCID column (match English or translated)
90+
if (column === 'PSCID' || column === labelPSCID) {
91+
return (
8892
<td>
89-
<a href={this.props.baseURL +
90-
'/' +
91-
rowData['DCCID']
92-
}>
93+
<a href={this.props.baseURL + '/' + rowData['DCCID']}>
9394
{rowData['PSCID']}
9495
</a>
9596
</td>
9697
);
97-
break;
98-
case 'DCCID':
99-
reactElement = (
98+
}
99+
100+
// DCCID column
101+
if (column === 'DCCID' || column === labelDCCID) {
102+
return (
100103
<td>
101-
<a href={this.props.baseURL +
102-
'/' +
103-
rowData['DCCID']
104-
}>
104+
<a href={this.props.baseURL + '/' + rowData['DCCID']}>
105105
{rowData['DCCID']}
106106
</a>
107107
</td>
108108
);
109-
break;
110-
case 'Feedback Level':
109+
}
110+
111+
// Feedback Level column — build link depending on row data
112+
if (column === 'Feedback Level' || column === labelBVL) {
111113
let bvlLink = '';
112114
let bvlLevel = '';
113115
if (rowData['Instrument']) {
114116
bvlLink = this.props.baseURL +
115-
'/instruments/' +
116-
rowData['Test Name'] +
117-
'/?candID=' +
118-
rowData['DCCID'] +
119-
'&sessionID=' +
120-
rowData['sessionID'] +
121-
'&commentID=' +
122-
rowData['commentID'];
123-
// Open feedback panel
124-
bvlLink += '&showFeedback=true';
125-
bvlLevel ='Instrument : ' + rowData['Instrument'];
117+
'/instruments/' +
118+
rowData['Test Name'] +
119+
'/?candID=' + rowData['DCCID'] +
120+
'&sessionID=' + rowData['sessionID'] +
121+
'&commentID=' + rowData['commentID'] +
122+
'&showFeedback=true';
123+
bvlLevel = t('Instrument', {ns: 'behavioural_qc'}) + ' : '
124+
+ rowData['Instrument'];
126125
} else if (rowData['Visit']) {
127126
bvlLink = this.props.baseURL +
128-
'/instrument_list/' +
129-
'?candID=' +
130-
rowData['DCCID'] +
131-
'&sessionID=' +
132-
rowData['sessionID'];
133-
// Open feedback panel
134-
bvlLink += '&showFeedback=true';
135-
bvlLevel ='Visit : ' + rowData['Visit'];
127+
'/instrument_list/?candID=' + rowData['DCCID'] +
128+
'&sessionID=' + rowData['sessionID'] +
129+
'&showFeedback=true';
130+
bvlLevel = t('Visit', {ns: 'behavioural_qc'}) + ' : '
131+
+ rowData['Visit'];
136132
} else {
137-
bvlLink = this.props.baseURL +
138-
'/' + rowData['DCCID'];
139-
// Open feedback panel
140-
bvlLink += '/?showFeedback=true';
141-
bvlLevel ='Profile : ' + rowData['PSCID'];
133+
bvlLink = this.props.baseURL + '/' + rowData['DCCID']
134+
+ '/?showFeedback=true';
135+
bvlLevel = t('Profile', {ns: 'behavioural_qc'}) + ' : '
136+
+ rowData['PSCID'];
142137
}
143-
reactElement = (
138+
return (
144139
<td>
145140
<a href={bvlLink}>{bvlLevel}</a>
146141
</td>
147142
);
148-
break;
149-
default:
150-
reactElement = (
151-
<td>{cell}</td>
152-
);
153143
}
154-
return reactElement;
144+
145+
return <td>{cell}</td>;
155146
}
156147

157148
/**

0 commit comments

Comments
 (0)