-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #196 - create separate display of any in-progress Ensemble
- Loading branch information
Showing
11 changed files
with
261 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/jitterted/mobreg/adapter/in/web/member/InProgressEnsembleView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.jitterted.mobreg.adapter.in.web.member; | ||
|
||
import com.jitterted.mobreg.application.MemberService; | ||
import com.jitterted.mobreg.domain.Ensemble; | ||
import com.jitterted.mobreg.domain.MemberId; | ||
|
||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
public record InProgressEnsembleView(String name, | ||
String url, | ||
String startTime, | ||
List<String> participants, | ||
List<String> spectators) { | ||
|
||
public static InProgressEnsembleView from(Ensemble ensemble, MemberService memberService) { | ||
return new InProgressEnsembleView(ensemble.name(), | ||
ensemble.meetingLink().toString(), | ||
ensemble.startDateTime() | ||
.toLocalTime() | ||
.format(DateTimeFormatter.ofPattern("hh:mm a")), | ||
namesOf(ensemble.acceptedMembers(), memberService), | ||
namesOf(ensemble.spectators(), memberService)); | ||
} | ||
|
||
public static List<String> namesOf(Stream<MemberId> memberIds, MemberService memberService) { | ||
return memberIds | ||
.map(memberId -> memberService.findById(memberId).firstName()) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.