Skip to content

Commit

Permalink
refactor: sort work units when summarizing the month
Browse files Browse the repository at this point in the history
  • Loading branch information
sipasi committed Aug 16, 2024
1 parent bf49e13 commit bc0e5be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/data/summaries/works_summarizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ class WorksSummarizer {
final infos = map.entries.map((e) {
return WorkInfo(
e.key,
e.value.entries.map((e) => e.value).toList(),
e.value.entries.map((e) => e.value).toList()..sort(compareIgnoreCase),
);
});

return infos.toList();
}

static int compareIgnoreCase(UnitDaysPairs left, UnitDaysPairs right) {
final leftLower = left.unit.value.toLowerCase();
final rightLower = right.unit.value.toLowerCase();

return leftLower.compareTo(rightLower);
}
}

0 comments on commit bc0e5be

Please sign in to comment.