Skip to content

Commit

Permalink
feat(app): check for currently shown genes if inhibitor
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Nov 28, 2024
1 parent 4f28ef0 commit 9b1be29
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/lib/report/pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,20 @@ class ReportPage extends HookWidget {
}
return allAffectedDrugs;
}

List<Widget> _buildGeneCards({ List<String>? drugsToFilterBy }) {
final userGenotypes = drugsToFilterBy != null
Iterable<GenotypeResult> _getRelevantGenotypes(List<String>? drugSubset) {
return drugSubset != null
? UserData.instance.genotypeResults!.values.filter((genotypeResult) =>
_getAffectedDrugs(
genotypeResult.key.value,
drugSubset: drugsToFilterBy,
drugSubset: drugSubset,
).isNotEmpty
)
: UserData.instance.genotypeResults!.values;
}

List<Widget> _buildGeneCards({ List<String>? drugsToFilterBy }) {
final userGenotypes = _getRelevantGenotypes(drugsToFilterBy);
final warningLevelCounts = <String, WarningLevelCounts>{};
for (final genotypeResult in userGenotypes) {
warningLevelCounts[genotypeResult.key.value] = {};
Expand Down Expand Up @@ -122,8 +126,8 @@ class ReportPage extends HookWidget {
final geneCards = _buildGeneCards(
drugsToFilterBy: currentListOption.drugSubset,
);
// TODO: only for currently shown genes
final hasActiveInhibitors = activeDrugs.names.any(isInhibitor);
final relevantGenes = _getRelevantGenotypes(currentListOption.drugSubset);
final hasActiveInhibitors = relevantGenes.any((genotypeResult) => activeDrugs.names.any((drug) => isInhibited(genotypeResult, drug: drug)));
return PopScope(
canPop: false,
child: unscrollablePageScaffold(
Expand Down

0 comments on commit 9b1be29

Please sign in to comment.