Skip to content

Commit

Permalink
feat: rename variables to clarify intent
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-aksamentov committed Aug 31, 2020
1 parent cadae7e commit 389dd79
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/web/src/algorithms/QC/runQC.ts
Expand Up @@ -11,8 +11,8 @@ export type Enableable<T> = T & { enabled: boolean }

export interface QCResult {
seqName: string
score: number
status: QCRuleStatus
overallScore: number
overallStatus: QCRuleStatus
privateMutations?: QCResultPrivateMutations
missingData?: QCResultMissingData
snpClusters?: QCResultSNPClusters
Expand Down Expand Up @@ -57,5 +57,5 @@ export function runQC({ analysisResult, privateMutations, qcRulesConfig }: RunQC

const status = getQCRuleStatus(score)

return { seqName: analysisResult.seqName, ...result, score, status }
return { seqName: analysisResult.seqName, ...result, overallScore: score, overallStatus: status }
}
2 changes: 1 addition & 1 deletion packages/web/src/algorithms/tree/treeAttachNodes.ts
Expand Up @@ -136,7 +136,7 @@ export function get_node_struct(seq: AnalysisResult): AuspiceTreeNodeExtended {
qc,
} = seq

const qcStatus = qc?.status
const qcStatus = qc?.overallStatus
let qcFlags = 'Not available'
if (qc) {
const { privateMutations, snpClusters, mixedSites, missingData } = qc
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/components/Results/ListOfQcIsuues.tsx
Expand Up @@ -17,7 +17,7 @@ export interface ListOfQcIssuesProps {
export function ListOfQcIssues({ qc }: ListOfQcIssuesProps) {
const { t } = useTranslation()

const { score, privateMutations, snpClusters, mixedSites, missingData } = qc
const { overallScore, privateMutations, snpClusters, mixedSites, missingData } = qc

const messages = [
formatQCMissingData(t, missingData),
Expand All @@ -37,7 +37,7 @@ export function ListOfQcIssues({ qc }: ListOfQcIssuesProps) {

return (
<>
<div>{t('Aggregate QC score: {{score}}', { score: round(score) })}</div>
<div>{t('Aggregate QC score: {{score}}', { score: round(overallScore) })}</div>
<div>
{t('QC issues:')}
<ul>{issues}</ul>
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/components/Results/ResultsTable.tsx
Expand Up @@ -181,9 +181,9 @@ function TableRowComponent({ index, style, data }: RowProps) {
const even = index % 2 === 0
let color = even ? '#ededed' : '#fcfcfc'
if (highlightRowsWithIssues && qc) {
if (qc.status === QCRuleStatus.mediocre) {
if (qc.overallStatus === QCRuleStatus.mediocre) {
color = mix(0.5, color, '#ffeeaa')
} else if (qc.status === QCRuleStatus.bad) {
} else if (qc.overallStatus === QCRuleStatus.bad) {
color = mix(0.5, color, '#eeaaaa')
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/web/src/filtering/filterByQCIssues.ts
Expand Up @@ -15,9 +15,9 @@ export function filterByQCIssues({ showGood, showMediocre, showBad, showErrors }
const isPending = !isError && (!result || !qc)

// The sequences which are still being processed are presumed to be 'good' until QC results come and prove otherwise
const isGood = isPending || qc?.status === QCRuleStatus.good
const isMediocre = qc?.status === QCRuleStatus.mediocre
const isBad = qc?.status === QCRuleStatus.bad
const isGood = isPending || qc?.overallStatus === QCRuleStatus.good
const isMediocre = qc?.overallStatus === QCRuleStatus.mediocre
const isBad = qc?.overallStatus === QCRuleStatus.bad

const good = showGood && isGood
const mediocre = showMediocre && isMediocre
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/helpers/sortResults.ts
Expand Up @@ -55,7 +55,7 @@ export function sortByQcIssues(results: SequenceAnalysisState[], direction: Sort
(res) => {
// Sort errored sequences as having very bad QC results
const errorScore = res.errors.length * 1e9
const qcScore = res.qc?.score ?? defaultNumber(direction)
const qcScore = res.qc?.overallScore ?? defaultNumber(direction)
return errorScore + qcScore
},
direction,
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/types/jsonexport.d.ts
Expand Up @@ -14,7 +14,7 @@ declare module 'jsonexport' {
rename?: string[] // Array Used to set a custom header text, defaults to [] example ['Last Name', 'Name']

// Post-process headers after they are calculated with delimiters, example mapHeaders: (header) => header.replace(/foo\./, '')
mapHeaders?: (string) => string
mapHeaders?: (header: string) => string

// Change the file row delimiter
// Defaults to , (cvs format).
Expand Down

0 comments on commit 389dd79

Please sign in to comment.