@@ -28,11 +28,16 @@ const ScoreBreakdown = (score, breakdown, category, scoreType, onViewDetails) =>
2828 } ,
2929 span ( 'for' ) ,
3030 ( ) => {
31+ const scoreValue = getValue ( score ) ;
3132 const selectedScoreType = getValue ( scoreType ) ;
33+ const scoreTypeOptions = [ 'score' , 'cde_score' ] . filter ( ( s ) => scoreValue [ s ] )
34+ if ( ! scoreTypeOptions . length ) {
35+ scoreTypeOptions . push ( 'score' ) ;
36+ }
3237 return Select ( {
3338 label : '' ,
3439 value : selectedScoreType ,
35- options : [ 'score' , 'cde_score' ] . map ( ( s ) => ( { label : SCORE_TYPE_LABEL [ s ] , value : s , selected : s === scoreType } ) ) ,
40+ options : scoreTypeOptions . map ( ( s ) => ( { label : SCORE_TYPE_LABEL [ s ] , value : s , selected : s === scoreType } ) ) ,
3641 onChange : ( value ) => emitEvent ( 'ScoreTypeChanged' , { payload : value } ) ,
3742 } ) ;
3843 } ,
@@ -41,7 +46,7 @@ const ScoreBreakdown = (score, breakdown, category, scoreType, onViewDetails) =>
4146 ) ,
4247 ( ) => div (
4348 { class : 'table-header breakdown-columns flex-row' } ,
44- getValue ( breakdown ) ?. columns ?. map ( column => span ( {
49+ getValue ( breakdown ) ?. columns ?. map ( column => span ( {
4550 style : `flex: ${ BREAKDOWN_COLUMNS_SIZES [ column ] } ;` } ,
4651 getReadableColumn ( column , getValue ( scoreType ) ) ,
4752 ) ) ,
@@ -64,7 +69,7 @@ const ScoreBreakdown = (score, breakdown, category, scoreType, onViewDetails) =>
6469
6570/**
6671 * Translate the column names for the table.
67- *
72+ *
6873 * @param {Array<string> } columns
6974 * @param {('table_name' | 'column_name' | 'semantic_data_type' | 'dq_dimension') } category
7075 * @param {('score' | 'cde_score') } scoreType
@@ -82,7 +87,7 @@ function getReadableColumn(column, scoreType) {
8287}
8388
8489/**
85- *
90+ *
8691 * @param {object } row
8792 * @param {string } column
8893 * @returns {<string> }
@@ -205,4 +210,4 @@ stylesheet.replace(`
205210}
206211` ) ;
207212
208- export { ScoreBreakdown } ;
213+ export { ScoreBreakdown } ;
0 commit comments