diff --git a/app/lib/common/models/userdata/userdata.dart b/app/lib/common/models/userdata/userdata.dart index 181b2865..da3b0c57 100644 --- a/app/lib/common/models/userdata/userdata.dart +++ b/app/lib/common/models/userdata/userdata.dart @@ -230,6 +230,18 @@ List activeDrugsFromHTTPResponse(Response resp) { return activeDrugs; } +String possiblyAdaptedPhenotype(GenotypeResult genotypeResult) { + final originalPhenotype = genotypeResult.phenotypeDisplayString; + if (!isInhibited(genotypeResult)) { + return originalPhenotype; + } + final overwrittenLookup = UserData.overwrittenLookup(genotypeResult.gene); + if (overwrittenLookup == null) { + return '$originalPhenotype$drugInteractionIndicator'; + } + return '$overwritePhenotype$drugInteractionIndicator'; +} + bool isInhibited( GenotypeResult genotypeResult, { String? drug } diff --git a/app/lib/report/pages/gene.dart b/app/lib/report/pages/gene.dart index a07d0e8b..37cc3ce6 100644 --- a/app/lib/report/pages/gene.dart +++ b/app/lib/report/pages/gene.dart @@ -89,12 +89,9 @@ class GenePage extends HookWidget { } TableRow _buildPhenotypeRow(BuildContext context) { - final phenotypeText = isInhibited(genotypeResult) - ? '${genotypeResult.phenotypeDisplayString}$drugInteractionIndicator' - : genotypeResult.phenotypeDisplayString; return _buildRow( context.l10n.gene_page_phenotype, - phenotypeText, + possiblyAdaptedPhenotype(genotypeResult), tooltip: context.l10n.gene_page_phenotype_tooltip, ); diff --git a/app/lib/report/pages/report.dart b/app/lib/report/pages/report.dart index 08617b47..cb1abdbe 100644 --- a/app/lib/report/pages/report.dart +++ b/app/lib/report/pages/report.dart @@ -121,9 +121,6 @@ class GeneCard extends StatelessWidget { @override Widget build(BuildContext context) { - final phenotypeText = isInhibited(genotypeResult) - ? genotypeResult.phenotypeDisplayString - : '${genotypeResult.phenotypeDisplayString}$drugInteractionIndicator'; final hasLegend = warningLevelCounts.values.any((count) => count > 0); return RoundedCard( onTap: () => context.router.push( @@ -143,7 +140,7 @@ class GeneCard extends StatelessWidget { ), SizedBox(height: 8), Text( - phenotypeText, + possiblyAdaptedPhenotype(genotypeResult), style: PharMeTheme.textTheme.titleSmall, ), ],