Skip to content

Commit

Permalink
feat(#712): fix sorting of warning levels with severity 0
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Sep 4, 2024
1 parent d1029cc commit 351f6b0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/lib/report/pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ReportPage extends StatelessWidget {
int _getSeverityCount(WarningLevelCounts warningLevelCounts, int severity) {
return warningLevelCounts.filter(
(warningLevelCount) => warningLevelCount.key.severity == severity
).values.first;
).values.sum();
}

Widget _buildReportPage(BuildContext context, ActiveDrugs activeDrugs) {
Expand Down Expand Up @@ -49,14 +49,16 @@ class ReportPage extends StatelessWidget {
var sortedGenotypes = userGenotypes.sortedBy(
(genotypeResult) => genotypeResult.gene
);
final sortedWarningLevels = WarningLevel.values.sortedBy(
(warningLevel) => warningLevel.severity
);
for (final warningLevel in sortedWarningLevels) {
final sortedWarningLevelSeverities = Set<int>.from(
WarningLevel.values
.sortedBy((warningLevel) => warningLevel.severity)
.map((warningLevel) => warningLevel.severity)
);
for (final severity in sortedWarningLevelSeverities) {
sortedGenotypes = sortedGenotypes.sortedByDescending((genotypeResult) =>
_getSeverityCount(
warningLevelCounts[genotypeResult.gene]!,
warningLevel.severity,
severity,
),
);
}
Expand Down

0 comments on commit 351f6b0

Please sign in to comment.