Skip to content

Commit

Permalink
fix(replies): show other members replies with no answer
Browse files Browse the repository at this point in the history
  • Loading branch information
mforesti committed Nov 15, 2024
1 parent 217942d commit 1d61500
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 2 additions & 0 deletions lib/models/default_reply.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/models/enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ enum InviteMethods {
enum ReplyOptions {
yes,
no,
maybe,
none,
}

/// The different roles a user can have in a group
Expand Down
2 changes: 2 additions & 0 deletions lib/models/reply.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions lib/selectors/selectors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,24 @@ ScheduleEventDetails? selectScheduleForDate(

if (scheduleSummary == null) return null;

Member getMember(int memberId) {
final member = state.members.entities[memberId.toString()]!;
Member getMember(Member member) {
final profile = state.profiles.entities[member.profileId.toString()];

return member.copyWith(
displayNameOverride:
member.displayNameOverride ?? profile?.displayName);
}

final memberReplies = scheduleSummary.memberReplies.entries
.map((e) => (getMember(e.key), e.value))
.whereNot((e) =>
e.$1.id ==
scheduleSummary
.targetMemberId) // Remove target user from the list below
final members =
groupMembersSelector(state, scheduleSummary.groupId.toString());
final memberReplies = members
// Fill in the blanks for members who haven't replied
.map((m) {
final reply = scheduleSummary.memberReplies[m.id];
return (getMember(m), reply ?? ReplyOptions.none);
})
// Remove target user from the list below
.whereNot((e) => e.$1.id == scheduleSummary.targetMemberId)
.toList();

// TODO This should be a selector and memoized
Expand Down

0 comments on commit 1d61500

Please sign in to comment.